UK-flagged merchant vessels will be allowed to carry armed guards to combat piracy, the Prime Minister David Cameron said.