I mean if it's a valid question asking if she has a boyfriend within the first 5 questions?

What i have noticed is that a lot of girls seem to be so naive that when a guy talks to her at a bar, she thinks he just wants a conversation with NO hidden agenda. So i've talked to girls for quite some time, felt like we're hitting it on and in the end she says she has a boyfriend.

So, is it "ok" to ask early on if she has a boyfriend or not? Because it IS a mood killer if she does have one.