I think it depends on how you want to come across. If you ask up front you'll generally get a direct answer, however people may be put off by that and see you as somewhat tactless. There's also a good chance that this will be interpreted as an expression of interest, which means you've put your cards on the table very early (which may or may not be a good thing, case depending).
I guess it depends ultimately on why you'd want to know. If you actually *are* checking for competition before making a move, are you really sure that you shouldn't be getting to know them a bit better first (whereby the question would answer itself)? If you're just interested in being friends and are asking without any particular interest in filling the role then it becomes a much more innocent question, but still one which may be interpreted the wrong way.
Personally, I tend towards the approach where you don't ask, because it's not really something I'm interested in (firstly because I'm not interested in making a move, secondly because it's not something I worry about when making friends). If they feel it's worth mentioning then they'll do so for themselves, but I don't ask because aside from being no concern of mine, there's too much potential for it to be taken the wrong way or be accidentally offensive or upsetting to the other person (for example if they have had a recent breakup).
Edit: and wow, u_i_c, maybe it's just me being cynical, but that method there would make me think the person was even dodgier than just asking up front, because it's still obvious, but at the same time says "I invested time and effort into coming up with a way to ask you without you realising (and failed)".