If you are non-resident and own urban property in Spain
The answer depends on use. A property kept available for personal use may create imputed income; rental periods create rental income; and a sale creates a capital gain. One calendar year can contain more than one type of use.
Co-ownership and days
The obligation is apportioned by ownership and period. With several owners, each taxpayer needs to analyse their own share and residence.
If you have missed several years
Do not file random years just to catch up. First reconstruct which periods are still open, how the property was used, cadastral values and ownership. Then regularise the position coherently.