How to prevent slimes from spawning in certain areas
Slimes can spawn in any light level, so having your area well-lit will not stop them.
However, just as with other mobs, slimes require an opaque block to spawn on top of. You can stop them from spawning by lining the floor of your area with transparent blocks, such as glass or slabs.
Additionally, the three sizes of slimes require different amounts of room (i.e. non-opaque blocks like air, signs, torches, etc.) for them to spawn:
- Big Slimes: 3x3x3 block area.
- Small Slime: 3x3x2 block area.
- Tiny Slime: 1x1x2 block area (or 1x1x1 if the upper block is not opaque).
So, another solution is to simply fill in the area as much as possible.