As it is, right now, DF has a major flaw in it, in that there are quite a few simple easy ways of completely sealing off a fortress and protecting it from attack. Most of these have no counter, or of those that can be breached, the enemies that can breach them are often exceedingly rare. Right now this is one of the largest factors marring combat and making DF far too easy. There have been threads on various subjects like tunneling and so on before, but I aim for this thread to have a more comprehensive goal, to find every way of making a fortress impenetrable, and figuring out how to fix each of them.
So, to start this process:
Problem: Doors/Hatches
Description: Ahh, the simple door, a slab of rock, a block of wood, a chunk of metal menacing with spikes of cat leather. Lets dwarves go where you want them to, and when locked, prevents all but extremely rare enemies from entering your fortress. Ambushes may make it through one set of doors, but a simple airlock design with a pet between will keep them from getting through a second set. They can be locked anywhere at any time, even if there's no dwarves around, and when they are nearly impenetrable.
Solutions: Make doors destroyable. Not just by specific enemies, but by anyone. Make it take some time, building destroyer shouldn't be the only one to be able to knock down doors, they should just be able to do it a bit faster. Treat buildings more like creatures, do damage to them, wear them down, and eventually you can smash through them. A set of steel doors should provide better protection then something made out of wood.
Ambushers can sneak up on your fortress, but can be easily detected and doors can be locked. Something which could help make them more difficult is making it so a door must be locked and barred by a dwarf, rather than locking itself.
Problem: Walls
Description: The standard of any above-ground fortress or fortification, a wall will keep out anything you want kept out, with no exceptions, indefinitely. They may have weaker points to them, such as doors, or bridges, or open ceilings, but they don't have to. You can simply make a solid wall all the way around, perhaps tear it down and rebuild it if you want to let anything in or out. Or for an underground fortress, a single wall between the inside and the outside can provide an absolute defense.
Solutions: Same as for doors largely, let walls and constructions be destroyed. Siege weapons help, but give a group of goblins some time, and perhaps some clubs or picks, and they should be able to take down or deconstruct a wall eventually. There are other solutions that deal with this partially, flying enemies could go over them, but you can always build walls above, tunneling enemies could go under them, but you can always build walls below. Those are nice traits to provide a bit more challenge in building a fortress, but in the end, to break an impenetrable fortress, you're going to have to deal with the wall directly.
Problem: Channels
Description: A hole in the ground. Simple, fast to make, but very effective. Nothing that moves on land or sea can cross it, only those that can fly can breach it. A channel between you and the outside world will keep you protected from nearly anything, certainly from sieges and the like. They commonly can have bridges over them, but it's not required, they may often be filled with water or magma, but that doesn't make them any more impenetrable then they are already.
Solutions: Intelligent enemies could build floors across them. Those without bridge building skills could find other methods, fly over them, climb out of them, dig ramps into adjacent squares, build staircases from inside them, etc. Some of these (any that require something to be down in the pit) may be limited by how well a creature can deal with water or magma. Solutions to dealing with channels should keep in mind that there will often also be a bridge or a wall or such on the other side that must be dealt with, and solutions should be compatible with that. Channels may also span several levels and the fortress may be above or below the level that the attacking side is on.
Problem: Bridges
Description: A nearly impenetrable obstacle when raised (similar to a door), a path across a channel when lowered. Bridges have many numerous ways of assisting in making a fortress impenetrable. They can block an army when raised, and smash it when lowered, they can control access over a channel, and drop attacking forces into pits.
Solutions: There needs to be a number of solutions for bridges, given the variety of ways they can be used. When raised and used as a simple wall, it should be possible to destroy them, just as with doors. If there's a channel in the way that can first be dealt with, or it could also be possible to do something like grab the gate with grappling hooks and force it down. To prevent an army from simply being dropped repeatedly into a pit, bridges could be treated more like doors, where you can't use them once an enemy has taken control of them. Anchored down so they can't raise or retract. As for smashing things with them, that might still be possible, but should at the very least damage a bridge to be used in such a way, if not destroy it depending on what's being crushed.
Problem: Bars/Floodgates/Grates
Description: More standard stuff, things that can be dropped into place or removed.
Solution: As with before, anything that can be placed into someone's path should be able to be potentially destroyed. Grates have an added factor though that they can be removed and drop people down into pits. Some of the solutions of bridges could work here, or the spaces they occupy floored over like channels.
Problem: Water/Lava
Description: Liquid stuff, you can try to smash your way through it, but it won't be very effective. Useful in drowning or burning armies, could be used to push enemies over ledges.
Solutions: There's not a lot here that I can think of, floodgates could be smashed down if they drop into place, making it hard for repeat use of a drowning trap. Although drowning traps that blocked flow of water simply by height and walls, such as one where the invading army had to descend a few levels into to get into your fortress, would be hard to prevent repeat usage. Anchoring bridges in place can make it hard to drop sieges into it. Lava falling from above through grates would be hard to stop though, and entrances covered by either of them would be very difficult to get into. Enemies which can't be drowned, or which are immune to high temperatures could make it past these obstacles. A bunch of water pushing enemies off a cliff though would be very hard for anyone to get through, and I can't really see any good solutions for it. Otherwise, if the AI is good enough, and there are other choices available, they might be able to find (or make)some way around them, even if it took longer.
Problem: Natural walls/Obsidian
Description: The main defense of underground fortresses, it can block off large sections and funnel enemies through a few narrow points. Normally, there has to be a way through it, as the dwarves had to get down there in the first place. However, with some lava and water available, A fortress can seal itself off entirely, behind natural walls. Other then that, it can be used to block access to all but another path which is virtually impenetrable (like the immersed entrance above).
Solutions: At this point, there's no way that I can see forward other than tunneling enemies, certainly an obsidian capped underground fortress has no other entrance, and to get around other impenetrable obstacles, this may be one of the only options available.
Problem: Traps
Description: 1000 spinning blades of death, or a single wooden cage trap. There's little more effective at killing or capturing enemies then these. Enough of these can take down virtually anything, and they're often very simple to build. This isn't the standard impenetrable defense, because it is possible to get through, but I thought I'd include it anyway because virtually anything without [trapavoid] can be easily taken down or captured by traps. Even those that do have it can be stopped by them under certain conditions (cave-ins)
Solutions: Limit traps' effectiveness, put a single weapon in a weapon trap, make it so traps can be disarmed or discovered. If someone in a siege get caught in a cage trap, have their companions stop and break them out. Megabeasts either shouldn't be able to be caged at all, or if they are, should break themselves out of any cage given a bit of time, might also apply to other enemies as well.
That's about all that comes to mind at the moment. As it is, a fortress can be made impenetrable, or nearly so, with nearly any one of these individually. If anyone can think of any more to add it would be helpful, as well as any other possible solutions to these defenses.