Hamlet is not given a last name in the play: he is simply Hamlet, Prince of Denmark. Some critics have found it significant that he has been given the same name as his father, the murdered King Hamlet, saying it increases the identification, and hence the significance of the break, between the two men. Harold Bloom, for example, sees the common name reinforcing the idea that the ghost of the father expects the younger Hamlet simply to be a mirror image of him and unquestioningly avenge his death as he asks. However, Shakespeare turns the revenge motif on its head, Bloom says, by making Hamlet like his father only in name: Hamlet questions his father and thinks for himself, resisting revenge without proof. Likewise, Rene Girard sees the younger Hamlet as breaking the cycle of revenge and violence by questioning the veracity of the ghost and not simply immediately replicating the sins of the fathers, as Fortinbras and Laertes are willing to do.
If you want to get really technical, the Danish Royal Family surname is Schleswig-Holstein-Sonderburg-Glücksburg. But back in Hamlet's day, the time of medieval Kings, there was no house name or surname.
(As you may know, the surname of British Royalty used to be Saxe-Coburg-Gotha, but, because of World War I, it was changed to Windsor in a rejection of German associations in 1917.)
So, Hamlet's father was King Hamlet, and his son, also named Hamlet, was Prince Hamlet or Hamlet, Prince of Denmark.
The same probably goes for everyone in the play: Claudius is just Claudius, Gertrude, Gertrude, etc. At best, just to differentiate individuals with the same name, people may have been named something like this: if your name was John and you were the son of Eric, you would be John Ericson.
Hmmm, Hamlet Hamletson? Doesn't sound right somehow. Let's leave it as Hamlet.
As far as I know, Hamlet does not have a last name. This may seem strange to us, but it would not have been strange back then, especially for someone of royal blood.
In those days, royal families did not really have last names. There were names of dynasties, but those were not really family names in the way we think of them. So, for example, Queen Elizabeth could have been called Elizabeth Tudor, but that is not how she would have signed her name or anything. She was just Queen Elizabeth.