Gas boilers are allowed in attics but they must be provided with a boarded walkway to and from the attic hatch to the boiler and a work platform provided around the boiler.
It is recommended that the attic is accessed with a proper attic steps rather than a loose ladder.
The other issue with boilers in attics is nuisance lock outs. Any air whatsoever bled from the system via radiators or automatic air vents, will affect the boiler first due to it being the highest part of the system.
Other poster mentioned in a bathroom. This is only allowed if the boiler is room sealed and any of the electrics above 50VAC are in a lockable cupboard enclosure.
Moisture is going to be a big issue here for the longevity of the appliance.