Some dungeon generation code that generates some reasonably ok dungeons as a starting point:
http://www.cokeandcode.com/node/1445
Some discussion and extensions:
http://www.cokeandcode.com/node/1444
http://www.cokeandcode.com/node/1446
http://www.cokeandcode.com/node/1447
http://dl.dropbox.com/u/1668516/concept/better-dungeongeneration3.png
Kev