While I don't think the play is actually a knock-knock joke, I think those two words bear a bit more examination, because they sum up the entire play, and no, I'm not getting all existential on you. "Who's there?" is one of the core questions to be examined in the play, which is full of characters who are playing roles (intentionally or otherwise) or who are hiding behind tapestries or who are considering their own roles and positions.
HAMLET: Devoted son, scholar, Renaissance man. A thoughtful man. An intelligent, educated man who thinks a lot. A man who assumes "an antic disposition" in order to burn some time and try to figure out if the ghost he saw was telling the truth about Claudius's actions. Is Hamlet noble or twisted? Good-hearted or not? Does the real Hamlet love Ophelia for real, or was he simply using her? Is his treatment (or, perhaps, mistreatment) of her rooted in cruelty, or in a feeling of hurt and betrayal?
CLAUDIUS: Loving husband to Gertrude, whom he coveted, along with his brother's crown, efficient and organized ruler, murderer. His murder of King Hamlet was as much about Gertrude as anything else. His dealings with Hamlet throughout are based in fear - fear because the people love Hamlet; mistrust of Hamlet, lest he try to challenge Claudius to become the king. His condolence to Laertes is based more on his desire to avoid civic unrest than on any actual compassion; his decision to encourage Laertes in his revenge is similarly based on his sense of self-preservation.
POLONIUS: Devoted minister of state and advisor to the King. He seems a devoted father, but is he really? He sends someone to spy on Laertes in France. He dashes Ophelia's hopes of a happy future with Hamlet; not only does he tell her to reject Hamlet, he tells her she'd never be good enough for Hamlet. And then he uses her as a pawn to spy on Hamlet - something Hamlet figures out and resents, for which he abuses Ophelia (who has betrayed him and his trust). When it comes to Polonius, "who's there?" is a most interesting question. On the one hand, he's a windbag who can never say anything quickly if it might be said long. On the other, he's a schemer, sending a spy to watch his son and acting the role of spy himself on several occasions - sometimes openly, by conversing with Hamlet and trying to make him out, and at least twice by hiding behind tapestries to listen to Hamlet's conversations with women.
GERTRUDE: Widow of King Hamlet, bride to his brother Claudius, to whom she seems devoted. Had she loved her first husband? Whether she did or not, was she faithful to him, or did she sleep with Claudius before King Hamlet died? Did she know about - or at least suspect - Claudius's role in the death of her first husband before Hamlet told her of it? At the end, when she grabbed the cup to toast to Hamlet, did she know the cup was poisoned and drink anyhow?
OPHELIA: Devoted daughter, certainly, since she obeys her father's command to cease her relationship with Hamlet, whom she seems to love. Dedicated sister, who listens to and communicates with her brother. Who's there, though? Was she Hamlet's lover? Are the things she says and sings in her madness nonsensical? (I will argue later that they are not, in fact, and that although completely distraught, she wasn't completely off her rocker.)
ROSENCRANTZ & GUILDENSTERN: Childhood friends of Hamlet's. Sycophants willing to do whatever they can to assist Claudius. When they approach Hamlet, are they thinking they mean to help him, or are they acting out of a desire to ingratiate themselves with the king? At first those things might be compatible, but when they are no longer so, what motivates their actions?
THE GHOST: He's the ghost of King Hamlet, but when he first appears, it's unclear if he's friend or foe, and Hamlet spends a good part of the play determining whether or not the ghost was telling the truth, and/or whether it was an agent of the devil.
FORTINBRAS: Prince of Norway. Although he is onstage only little, he is a presence throughout the play - first as a potential invader who was thwarted, then as a petitioner asking for passage across Denmark in order to fight with Poland. At the end, was his visit intended as a social call or as an invasion?
The phrase "who's there?" is a question that might be asked in a number of scenes as a legitimate inquiry.
Consider the scene where Polonius and Claudius hide in order to observe Hamlet with Ophelia. Before that interaction, they get to overhear Hamlet's most famous soliloquy - "To be or not to be". Does Hamlet know that they are there? Any actor playing the part must make that decision when he plays the scene. Does he know they are there during the soliloquy? Does he know when he speaks to Ophelia? Does he figure it out as he talks with her? After all, he was sent for, and was probably told that it was Claudius or Polonius who sent for him - would he suspect they were hiding out? How much of what he says is for their benefit?
Consider the scene where Claudius is praying aloud, during which he confesses aloud his sins of murder and adultery. Hamlet enters during that scene. Was he there to hear the whole thing? Or did he only arrive in time to come upon him as he was engaged in trying to pray silently?
Consider the scene in which Polonius is hidden away to eavesdrop on Hamlet and Gertrude. Hamlet kills the man who hollers "help" from behind the curtain without knowing "who's there"; in fact, he believes (or hopes) that it was the king himself.
Or consider the scene in the graveyard, in which the gravedigger does not realize that the person with whom he is speaking about Yorick and Hamlet is, in fact the prince. And the royal procession arrives to bury Ophelia without initially knowing that Hamlet and Horatio are there.