Since this post is in the messaging forum, I'm assuming you're referring to calls and not text messages. I’ve never heard of texts coming in as private or unknown but it’s worth mentioning that there are caller ID spoofing apps available now that allow someone to change their caller id number when making calls and maybe an option for text messages as well. For blocking unknown or private numbers, there are two basic ways to approach this and both deal with the device. Depending on which phone you have, you may have access to download 3rd party apps from Google's Android Market or Blackberry's App World. Just search for "blocking calls" and most of those apps have a private or unknown block feature. I found this one in the Android Market.
Block all calls and texts from a person, a business, a prefix, or the world. Block calls and texts from any phone number, any area code or prefix, all private and restricted calls, or block everyone except your contacts. Block call with 'pick up and hang up' or 'send to voicemail'. Text blocking: Android 1.6+, US only: Block spam calls automatically (add 'Suspected spam' the 'Blacklist') and includes 7-day free trial of Caller ID.
The second option deals with non-smart phones that have a “Parental Controls” or “Security” feature that allows a user to set phone calls to “phonebook only” although not ideal since any number not in your phonebook would be rejected by the device.