Overwhelmed by political intrigue, confronted by a world adversarial to his moral sensibilities, Hamlet feels denied any vision of happiness.
Interestingly, the renowned Shakespearean critic Harold Bloom names Hamlet "Sigmund Freud's mentor" because Hamlet struggles with his ego in his revenge against the political intrigue of the "fishmonger" Polonius, the treachery of former friends Rosencrantz and Guildenstern, and the assault of Laertes and Claudius. He then is also challenged by his superego as he struggles against his love for Ophelia by whom he feels betrayed; further, he struggles with his conscience when he has the opportunity to kill Claudius. Certainly, his depression is good cause for psychoanalysis.
....To die, to sleep--
To sleep, perchance to dream, ay there's the rub;
For in that sleep of death what dreams may come
When we have shuffled off this mortal coil
Must give us pause. (3.1.64-68)
Added to these inner struggles, there is the troubled relationship that Hamlet has with his mother in terms of Freud's Oedipal complex. His resulting depression is also cause for psychoanalysis as he cannot make a decision to act.