Minecraft wiki entry for Spawn, associated text: The mob's collision box must not collide with any liquid.
If it is a bat, then...
the spawning block must be at level 62 or below.
If the real-time day is between October 20 and November 3, then the light level must be 7 or darker. Otherwise, the light level must be 4 or darker.