I think you additionally have to try once (!) to enter through the main gate, and discuss with the guards as to why the area is locked - that triggers the second conversation option with Lain about him being able to visit his friend Cedric - you have to insist on him to give you the key then.


In times of crisis it is of the utmost importance not to lose your head (Marie Antoinette)