In theory, if you try to build a door w/out a wall, you get that as an errour message ("Needs adjacent wall"). Doors should need to be connected to a wall - again, in theory.
However, I just built a door against a constructed wall, then deconstruct the wall, and the door stood, free of anything else, worked fine, lockable, etc.
(Note that if built connected to a natural wall, even diagonally, when that natural wall was removed, it toppled.)
Built a "middle" door in a 3-wide corridor this way - propped both side-doors open with military stationed there, kept standing. Deconstructed those doors, kept standing (but, oddly, was no longer "lockable").
However, Trade Caravans did not path thru doors, not even 3-wide, nor even when a single door was placed on the side of a 3-wide hallway. (In fact, the green "d's" of a check on the Trade Depot (<shift+d) stop 2 short of the doors, implying (to me) the fact that a 3x3 caravan cannot get their center square "next" to those doors.
(Interestingly, the caravans don't recognize it as a dealbreaker - they arrive, and try to get to the TD, but stop at the doors. Well, actually, the wagon itself stops - the draft animals overlap the doors. If all 3 doors are removed, the wagons continue to the TD.)
Call it an exploit, but since the wiki didn't mention it I thought I'd throw it out to the general population here for commentary before editing that.