You are of course refering to Act III scene 3. This is when Claudius is stricken by his guilt after seeing The Mousetrap play especially put on for him by Hamlet, and goes to pray to God. Hamlet passes him by on his way to his mother's chamber and has the perfect opportunity to kill him. Note what he says to himself as he surveys the praying Claudius:
Now might I do it pat, now he is praying,
And now I'll do't, and so he goes to Heaven,
And so am I reveng'd: that would be scann'd,
A villain kills my father, and for that
I his sole son, do this same villain send
The belief in Elizabethan times was that if you were killed whilst praying you would go straight to heaven and bypass the fires of Purgatory, where your sins during life were dealt with. Hamlet therefore chooses not to kill Claudius because he wants Claudius to suffer for his sins and actions during his life, rather than merely kill him and give him a ticket straight to heaven. He does not want to kill Claudius when "he is fit and season'd for his passage" as he says in the same scene. That would be no revenge whatsoever, especially as his own father's ghost is still languishing in purgatory as he tells Hamlet.