Actually, I don't think Hamlet ever fails to act appropriately. That's his problem, really. Even in the example supplied here by jagtig, Hamlet does not then and there kill Claudius because he wants to kill him perfectly, in the fullness of his guilt. There is no way for Hamlet to have known that Claudius couldn't pray.