In Shakespeare's Hamlet, Hamlet believes Claudius is doing more than just praying when he comes upon him in Act 3.3: he thinks he is confessing.
The play features Catholic theology more than it features Protestant. The Ghost wandering around until his sins are burnt and purged away is like the Catholic belief in purgatory, not like anything Protestants believe in:
I am thy father's spirit,
Doomed for a certain term to walk the night,
And for the day confined to fast in fires,
Till the foul crimes done in my days of nature
Are burnt and purged away.... (Act 1.5:9-13)
This is purgatory, or something close to it.
Applying Catholic theology to Hamlet's refusal to kill Claudius at prayer, then, suggests that Hamlet is reacting to the belief that if Claudius is confessing, his soul would already be purged and he would be guiltless before God and would therefore go straight to heaven.
It is no accident that Claudius in his prayer stresses forgiveness.
...Whereto serves mercy
But to confront...
(The entire section contains 2 answers and 705 words.)