Competent bodies can deny the data subjects’ rights according to Art. 15-22 GDPR pursuant to Art. 25 Organic Law 3/2018. However, this only applies if they process personal data for public statistical purposes and if the data in question is subject to statistical confidentiality by national or regional legislation in Spain.
According to Art. 26 Organic Law 3/2018, archiving in the public interest is lawful if it is mandated by Spanish legislation and the GDPR.