For example, if I want to apply to a job based in UK which requires security clearance, can I only do so if I'm a British national? What if I'm from another country belonging to the EU?
I believe It depends on the level of security clearance you require. For example, SIS/MI6 work that requires DV clearances has the following criteria
This guide here has the following values for residency for the following levels of clearance:
The following levels of security clearance don't specifically mention residency or citizenship as far as i can determine.
In case you aren't aware, the system in the UK is like Australia, you require the company you will work for to 'Sponsor' your application for clearance (basically you have to be better than everyone else in the UK that doesn't already have clearance).
In Australia, you are required to have citizenship to get the most 'simple' baseline clearance.