In theory, any land unclaimed so far can be claimed for ownership, and could make a solid base for arguing independance.
In practice, there is very little unclaimed land good for settling or even creating of new states. On the seas, the territorial waters of a country reach for up to 12 nautical miles from the land, and various rights and/or possibilities to intervene extend even further.
Risks depend on the exact place, but any location proven to be viable may be subsequently challenged by other, more established entities.
Preventive measures/solutions: exercise a strong effort to document the claim, and seek some kind of agreement with all or most of entities likely to dispute the claim.
You could buy some land in a remote area no one is interested in. There are numerous little valleys, even in the Alps or the Pyrenees, which are not suitable for ski resorts and are used only for pasture. Usually they benefit from clear water (from which you can draw electricity) and you can grow goats or even sheep for food.
There are many disputed mountainous areas close to international borders where some adventurous micronationalists could settle, and there are surely many uninhabited places in the world.
After a group of reefs were artificially heightened, the Republic of Minerva was declared on them. Later it was annexed by another state, because they "long served as fishing grounds for the Tongan people and have long been regarded as belonging to the Kingdom of Tonga".
For a somewhat different category, it could be possible to claim abandoned buildings (as the Freetown Christiania did in the midst of Copenhagen), and perhaps achieve a form of limited independence. In this example, it worked. This goes way beyond squatting.
A project named Microna attempted to build a town in Nevada, that is currently listed as a ghost town. They secured land, but didn't do much beyond minting a few coins. It reportedly failed due to the complexity of municipal zoning.
(more examples and attempts)