people should not speculate so quick. The picture below is from the lower panel of the A320 cockpit on the captains side.
if the lock was set in the "norm" position, the pilot outside would've been able to access the cockpit either by a code or another method. However, if it was in the "lock" position, the pilot would've been unable to enter the cockpit, regardless of his/her efforts.
Now, here's the thing. If it was indeed switched into "lock", what was the reason? SOP's, the pilot inside having an ulterior motive or he/she just became incapcitated and therefore was unable to switch to "unlock"?
there is also the element of mechanical failure on the part of the lock/switch too.
In the USA, per FAA regulations, whenever a pilot leaves the flight deck, a fellow crew member must replace him/her for however long they are away from the controls. This rule unfortunately is not universal.
by the sound of it, door was locked. Now whether it was locked due to a mechanical failure in the system, for procedural, suicidal reasons, or for procedural coupled with medical incapcitation, we'll have to wait and see.