Denial is defined a refusal to admit a truth, refusal to acknowledge something, or "a psychological defense mechanism in which confrontation with a personal problem or with reality is avoided by denying the existence of the problem or reality" (Merriam-Webster). Therefore, the occurrence of denial depends upon a specific situation.
An unconscious defense mechanism used to allay anxiety by denying the existence of important conflicts, troublesome impulses, events, actions, or illness.
(Farlex Partner Medical Dictionary)
A case where denial comes into play as a defense mechanism is after a trauma event that has been so horrible that a person may inadvertently subconsciously repress his or her association and experience with it. In this case, he or she denies that the event or problem exists or exists in its real form (for example, death) in order to cope with the struggle with or against the event or problem.
Psychiatry A primitive–ego defense–mechanism by which a person unconsciously negates the existence of a disease or other stress-producing reality in his environment, by disavowing thoughts, feelings, wishes, needs, or external reality factors that are consciously intolerable.
(McGraw-Hill Concise Dictionary of Modern Medicine)