Is it considered bad SEO practice if I block my whole website's contents and display a generic message to users from a specific country/countries? Isn't this considered as "cloaking" by the search engines and is there a risk of penalization? If yes, what is the best alternative?
I think this should not be a problem. Consider, however, that such blocking is necessary. Best to do a test on two domains and compare the results. Personally, I did not have such tests, but you gave me idea to make them. Just try to create two distinct language of the web site on a single domain. Use the /lang=en etc.
There shouldn't be any problem displaying different pages based on country. Millions of sites do this every day -- by showing their web sites in the appropriate language of their visitors. Why are you showing a different message based on country? You do realize there are easy ways around that solution - right?
No problem with that. Cloaking is a black hat technique to display something to the google bot and something else to the users. In your case, you are just blocking your site to users from specific countries. The only consequence it will have is that your site will not be indexed in the local domain of google. For example if you block in UK , google.uk will not be listing your search results. Lots of big sites do it , so if necessary go for it. If not, I would not recommend that because you will get some visitors from those countries and that will improve your rankings.
What I meant is that I will display a generic message such as "This site is not allowed in your country" to visitors from a specific list of countries (based on the visitor's IP) and display the real content to visitors from other countries.