Quite simply, Hamlet is saying it's better to stay in this life with all its problems and sorrow because there is no way of telling what the next life has in store for us:
To die, to sleep;
To sleep, perchance to dream. Ay, there's the rub.
And in that sleep of death what dreams may come
When we have shuffled off this mortal coil
Must give us pause.
In the age of exploration during which he lived, Shakespeare's metaphor of death was, and is, strikingly appropriate. Who, Hamlet asks, would continue with this weary life
But that the dread of something after death,
The undiscovered country, from whose bourn
No traveler returns, puzzles the will,
And makes us rather bear those ills we have
Than fly to others that we know not of?
If the play has a central point at which all its themes converge, this may be it. Hamlet's immediate problem is the revenge he feels compelled to carry out against Claudius. But apart from this he feels a general revulsion against life itself. His attitude is one most people can identify with, but only at our worst times. For Hamlet, it is a kind of ongoing fear of life, but it is balanced by his fear of death, and the result is that he's trapped in a kind of limbo from which there is no escape.