In the UK (IIRC IANAL, etc) the interview must be about assessing a candidate's suitability for a job and unsuitability for performing the work is the only justifiable reason for not offering someone a job, as opposed to, e.g. gender, disability, age, attractiveness, etc.
So I'm wondering how you'd justify not taking someone on by assessing them on a task that:
1) you know they can't do and, 2) if you've already vetted their CV, presumably those skills aren't required for the performance of the job in the first place.
It seems irrelevant whether they know you'll ask this kind of question, since they can't prepare for it, and flagging up something that is potentially unreasonable doesn't make it acceptable.
So, how do you objectively assess that person X did something that wasn't required for the job better than person Y, and justify to person Y why that matters?