A person who is non fiscal resident in Spain and is getting any kind of income in this country during the year has to be declaring and paying taxes for the incomes received. The most common case is a Non Resident person who owns a holiday house or property in Spain.
Regardless of whether or not the real-estate property is leased out, income from said property shall be subject to IRNR. However, the tax treatment varies depending on whether or not the property is leased.