Good question. That's what I'm struggling with right now. There really is no way to determine this accurately at interview stage - a smart person will always figure what kind of answer you're looking for. One way is to have them describe in detail what they're doing at their current/previous positions - if they mention legacy code/doing support or maintenance, ask for more details. See how they're describing it - matter-of-factly, or in a negative way.
However, there really is no good way to do this, other than to hire somebody for a trial period and have them do actual real world tasks. That's what I try to do most of the time, but unfortunately it's not always possible. If someone has better ideas, I would love to hear them.
Personally, I've found a sense of humour to be a reasonable indication - person 2 is more likely to be able to step back, smile, and say "okay, this is horrible and it's going to go badly for these reasons. But if I had to do it, I'd X the Y with Z". If they can do that and laugh about it, I get a sense of levity and perspective.
If you interview a guy/girl very good technically buy seems to work on shitty, boring and otherwise inane projects more often than not, you might still have found it. For a lot of corporations that's where you send the programmers that eat it up and just do their job...
However, there really is no good way to do this, other than to hire somebody for a trial period and have them do actual real world tasks. That's what I try to do most of the time, but unfortunately it's not always possible. If someone has better ideas, I would love to hear them.