Can you buy insurance to mitigate the risk against a loss of investment when purchasing securities?
Yes, you can insure against the fall in price of stock by purchasing a put option. You pay for a put and if the price of the share falls below the "strike price" of the put, then you can exercise the put. On exercise, the person who sold you the put contract agrees to buy the stock for the strike price, even though that strike price is higher than the market price. You can adjust the level of insurance by buying put options at higher or lower prices, or buying fewer put options than shares you own (leaving some shares uninsured).
Alternatively, you can minimize your risk exposure by investing in an index or other fund, which gives you partial ownership in a large number of shares. That means on any given day, lots of shares do worse and lots of shares do better. You can reduce the need for insurance by purchasing a lower-risk, lower-growth financial product.
Put options are basically this. Buying a put option gives you the right but not the obligation to sell the underlying security at a certain date for a fixed price, no matter its current market value at that time.
However, markets are largely effective, and the price of put options is such that if you bought them to cover you the whole time, you would on average pay more than you'd gain from the underlying security.
There is no such thing as a risk-free investment.
First off, the jargon you are looking for is a hedge. A hedge is "an investment position intended to offset potential losses/gains that may be incurred by a companion investment" (http://en.wikipedia.org/wiki/Hedge_(finance))
The other answers which point out that put options are frequently used as a hedge are correct. However there are other hedging instruments used by financial professionals to mitigate risk.
For example, suppose you would really prefer that Foo Corporation not go bankrupt -- perhaps because they own you money (because you're a bondholder) or perhaps because you own them (because you're a stockholder), or maybe you have some other reason for wanting Foo Corp to do well. To mitigate the risk of loss due to bankruptcy of Foo Corp you can buy a Credit Default Swap (http://en.wikipedia.org/wiki/Credit_default_swap). A CDS is essentially a bet that pays off if Foo Corp goes bankrupt, just as insurance on your house is a bet that pays off if your house burns down.
Finally, don't ever forget that all insurance is not just a bet that the bad thing you're insuring against is going to happen, it is also a bet that the insurer is going to pay you if that happens. If the insurer goes bankrupt at the same time as the thing you are insuring goes bad, you're potentially in big trouble.