First: Be general don't ask for specifics. For example, let's say you're interested in remodeling your home, and your neighbor recently had theirs done. If you want to find out how much they spent, ask something like, "What's the price range to redo a kitchen?" This deflects the question away from the person but still allows them to give you the information you want.
Next: Start with the reason you're asking. If you want to move into a coworker's swanky neighborhood, you can say, "I'm looking for an apartment in your area, and I'm not sure how much I should expect to spend. What do you pay in rent?" You might not get a specific answer, but at least you've phrased the question in a way that won't be perceived as rude.
And a final tip for asking a potentially nosy question: Offer an out. Try, "Do you mind if I ask...?" or "If this is too personal, you don't have to answer. But I was wondering. " then proceed with your question. This gives the person the opportunity NOT to respond and shows that you're aware that it might be inappropriate to ask. But often, people are more willing to share information than you might think - so it never hurts to ask. You just don't want to act as if you're entitled to the information.