Zombies of a village siege spawn even if the gamerule doMobSpawning is turned off.
Village sieges only happen
- when the moon is at the zenith
- when a player (not being a spectator) is nearby
- when no second village is close
- when the village has at least 10 doors
- when the village has at least 20 villagers
- with a chance of 1 / 10
Because a siege only happens with a chance of 1 / 10 it is easier to cause one by having a clock (for example repeater) setting the time to day, waiting a short moment (for example one redstone tick), setting the time to 18000 and then waiting a little bit longer.
- Create a Superflat world with the preset "Classic Flat"
- Turn the gamerule doMobSpawning off
- Get to a nearby village, for example by using /locate Village, and wait