Piracy exists in Somalia because the government lacks sufficient ability and influence to stop it.
It continues largely because the international community that has the ability to stop it, doesnt have the reason to. Modern warships can sink targets they cant visually see. The Gulf of Aden is large, but its not that large.
Most ships, even if owned by a western company, are flagged in a Convenient state - Panama, Liberia etc. these countries love the revenue form being a flag state but have no means of protecting their flagged ships. Most ships are crewed by non western crews.. many from the Philippines, Bangladesh, etc. again countries with limited abilities to protect their nationals internationally.
The west has many ships in the area, however they are reluctant to act for political reasons, if no nationals are involved, or its not a home flagged ship, its really not the concern of the country. The pirates get their million dollar ransom, which to a pirate is a wind fall, but to a shipping company, used to paying $60000/day fuel bills, really isnt that big a deal. Furthermore the risks to the pirates are relatively small - the French raided a la Poinete, a yacht that was taken by pirates and was crewed by french nationals, and the Indians sunk a Pirate mother ship last week. So for the pirates 2 out of over 100 incidents ended badly. To stop the pirates, the western world needs to actively seek them out, hunt them down and stop them from taking ships, as well as recapturing ships by force. When pirates begin to face the consequences - to this point there have been almost none, then they will cease their actions, because taking a ship no longer results in a quick profit for the prirates, and the risk of death goes up significantly for the actual takers of the ship.
Incidentally, the IMO is now recommending ships hire private security to protect them in troubled waters. Blackwater international has also purchased ships. The 18th century tales of piracy make a difference between a Privateer and a pirate a privateer was a mercenary ship working for a nation, to harass enemy shipping - they could take prizes, but paid a percentage to the crown, and wouldn't attack friendly shipping. a pirate had no Letter of Marque, paid no commissions, and attacked who he wanted when he wanted...
everything old is new again.
One final aside, those whom complain about copyright infringement by referring to it as piracy do a great disservice to the victims of piracy, imagine having your office attacked by men armed with machine guns and RPG's and your only defense is to run, and spray the attackers with a fire hose. from the floor above..