In Act 4, Scene 6, a sailor who is one of the pirates that attacked Hamlet's ship and ended up taking him prisoner, delivers a letter from Hamlet to Horatio. The sailor tells Horatio:
There's a letter for you, sir. It came from th' ambassador that was bound for England--if your name be Horatio, as I am let to know it is.
There does not seem to be anything especially ironic about the sailor's use of the term "ambassador," except for the fact that Hamlet is now a prisoner of the pirates. Hamlet really was an ambassador bound for England. He did not know the bellerophonic contents of the letter he was carrying until he broke the seal and read it, but he was an ambassador nevertheless. Rosencrantz and Guildenstern were only his attendants. They may not even have been able to speak English. Of course, they were also Hamlet's keepers, so to speak. Their mission was to make sure that Hamlet got to England and didn't perform any more mad pranks.
When the Danish ship was attached by pirates, Hamlet was first to counterattack them. This shows that he is capable of extremely courageous direct action when he doesn't stop to think. It is his introspection and his predilection for rational analysis that inhibit his other faculties. In his letter to Horatio, he says that he boarded the pirate ship all by himself.
On the instant they got clear of our ship, so that I alone became their prisoner.
Naturally Hamlet would have told his captors that he was an ambassador from the Danish court on his way to England. They would have no other source of information except what Hamlet told them. What he told them was the actual truth: he was an ambassador.