The above post is a good summary of the key religious themes in Shakespeare's Hamlet. There is little doubt that the Christian religious beliefs of the day are reflected in the play.
First, it is clear that Shakespeare's audience believed it wasa sin to take one's own life. As outlined above, Hamlet is so melancholy that he wishes he could take his own life and alleviate his suffering; however, he cannot, for God has determined that to be a sin.
And, because Hamlet is afraid not to believe in either a heaven or a hell, he cannot take his own life. There is some uncertainty as to the specifics of these places ("the undiscovered country"), perhaps, but their existence is not in question.
Hell is a reality, as presented by the Ghost in this play. He tells Hamlet he could tell him stories that would raise the hair on his head, but he is forbidden to do so.
Finally, dying without confession of sins is a direct path to purgatory. That's why the Ghost is there, and that is why Hamlet does not take advantage of his opportunity to kill Claudius who is (Hamlet thinks) confessing his sins.
Without question, the religious beliefs of the day are interwoven into the fabric of Shakespeare's Hamlet. Sin and the confession of it, heaven and hell, and eternal damnation are all an integral part of this story.
The christian element so predominates the play that Hamlet comes across as concerning itself with the theological questions of sin, damnation and salvation. Elizabethans had an obsessive concern with after-life and believed in heaven, hell and purgatory. Hamlet is obsessed with the thoughts of after-life --
O, that this too too sullied flesh would melt,
Thaw and resolve itself into a dew,
Or that the Everlasting had not fixed
His canon 'gainst self-slaughter....[I . ii.]
--and longs for the peace that the end of life alone can bring, regretting that suicide is forbidden. In his famous soliloquy, "To be or not to be ," he reflects upon the uncertainty of what follows death:
To die, to sleep;
To sleep: perchance to dream : ay, there is the rub.
For in that sleep death what dreams may come
When we have shuffled of this mortal coil,
Must give us pause....
The undiscovered country from whose bourn
No traveller returns, puzzles the will,
And makes us rather bear those ills that we have
Than fly to others we know not of ?
The ghost describes his experience of the purgatory where he had to go as he died without an opportunity to confess his sins. Ophilia is denied a Christian burial as she was considered to have committed suicide. The question whether the host is " a spirit of health, or goblin damned " resounds through the whole play. Hamlet's refusal to take advantage of the opportunity to avenge his father's death when he comes upon Claudius in prayer, is the result of belief in sin and salvation.