You can make mob-proof doors and also completely confuse the pathfinding AI using daylight detectors (also known as daylight sensors).