Reasoning
B is either a knave or a spy. If B is a spy, then A is truthful and is therefore the knight.
A - Knight
B - Spy
C - Knave
On the other hand, if B is the knave, there are two possibilities:
A - Spy
B - Knave
C - Knight
or
A - Knight
B - Knave
C - Spy
If C is either the knave or the knight, his answer to the question will be "No", and so the judge will not be able to draw a conclusion. On the other hand, C can answer "Yes" only if he is the spy.