Yes and no.
This is (usually) one of those backhanded compliments intended to flatter but usually reminds the person that they are indeed single and implies that it is somehow their fault (it likely is at least partially their fault, but we'll get to that later). So while it's not exactly inappropriate because of its intent, the execution of said question will always skew negatively and thus, it is probably inappropriate because it never has a positive outcome.
See, asking a person why they're single implies that their singledom is their own fault. Now, most people would argue that they are single for various reasons that aren't of their own doing i.e. can't find a (wo)man they get along with, opposite sex plays too many games, etc. Basically, their options have been more frog, less prince.
It also implies that its their choice to be single - where the offense usually comes in - when in reality, most women you ask this are as surprised as you are that they are single since they want to be in a relationship and see exactly whatever it is that you saw that made you ask such an inappropriate question!
Basically, they realize they are the cats meow because you realize they are the cats meow. However, that has nothing to do with how they ended up single. Those types of questions usually arise after some sort of interesting conversation or discovery that this person is super cool because of xyz. Chances are, if we were to dig into the relationship pasts of most folks, we'd be able to surmise and determine various reasons why said person who covets a relationship is single. Some of their own doing, some the doing of their lovers past.
There's another factor here that often comes into play: I'd wager that about 9 times out of 10, a man is asking this of a woman, which has to be completely frustrating for the woman. Standing in front of you is a man who has not only determined that you are a catch, enough to not only wonder why you are single, but enough to voice this confusion to you out loud...
...and then likely move on to the life he was leading before you two met. I don't know that I've ever met a woman who told me she met her boyfriend after a conversation where the dude she was talking to inquired as to why she was single. Not saying it can't or doesn't happen, I'm just saying I've never heard that story before.
Which leads to this other point - men ain't stupid. See, if we get to the point where we vocalize - externally - to you that we're surprised that you're single, to which you'll likely shrug after the pseudo annoyed look on your face dissipates, we are going to ask ourselves this same question (internally), except putting the emphasis on the "why" and not the "you", thus making us think if you were such a catch, you'd be caught since there's a really good chance that you're looking to be fried and fricasseed.
So basically, yes, its inappropriate. Just leave it alone.