Unless other changes have been made to the spawning code, enemy mobs can't spawn within 24 blocks of your current location. The exception to this is of course mob spawners, but that's a different story.
Update: According to Notch's blog post about changes coming in 1.6, the torches-on-fast-leaves bug is getting fixed:
- Fixed buttons and levers being placeable on leaves in “fast graphics” mode
This means that monsters can no longer spawn on leaves, either, as they are always considered transparent, even when using Fast graphics.
Monsters can spawn on any solid, non-transparent block which is at light level 7 or lower.
Signs, torches, rails, and the like are ignored when spawning monsters; they'll spawn on the block underneath just fine. This is why one-block-wide railways need to be lit.
Transparency means whether or not light passes through a block rather than whether you can see through it. Half-blocks, doors, stairs, and glass all count as transparent and prevent monster spawning. Leaves, oddly, count as transparent only when Fancy graphics are enabled. An easy way to test a block for transparency is to try placing a torch or sign on it — neither can be placed on transparent blocks. (Meaning that torches can be placed on leaves with Fast graphics, but not with Fancy.)
Torches put out light level 14, so monsters can't spawn within 5 blocks of a torch orthogonally or 3 blocks diagonally. If you put your torches in a diamond pattern, they can be up to 9 blocks apart, but it's best to move them closer than that on uneven terrain. (I use 5 myself.)
If you like, you can actually torch your treetops by changing your graphics to Fast, placing the torches, and switching back. Your torches will stay rooted, even though you wouldn't normally be able to place them that way. Personally, I think it makes them look rather cheerful. :-)
![treetop torches](https://i.stack.imgur.com/9Sv0G.jpg)
Best Answer
There is a safe radius around the player where creatures can not spawn. Normally (depending on how big of a 'trap' you have built) the player's radius includes a dungeon spawning trap. The Dungeon Spawner is unique in that it ignores this normal requirement for spawning, which is why they keep appearing in front of you.
So, if your no-spawn radius includes the dungeon then you are ok. Also of note is that dungeon spawners will spawn creatures in mid-air and above water, normal creatures can not do this because of the spawning rules. Again, depending on the design of your trap it should be inherently safe.
However if wherever you are standing can be reached by just walking or 1 block jumps or multi-block drops, be aware that something can spawn outside of your safety radius and eventually find its way to you. I suggest only going AFK if you are completely sealed off :)