In D&D your objective is to win.
Except for low level play, death really is the most trivial of speed bumps, just like what was said.
My players are much more frightened of losing than dying.
Most D&D is low-level. I usually end my games before they get to level 9, because a world where people can return from the dead can easily get out-of-control silly. Other games may continue to higher levels, after spending time at lower levels, but most D&D is still low-level.
If everyone dies, you lose your objective. Under most circumstances, nobody can make you lose your objective without your consent; if anyone tries, you can always resort to a dominance in arms.
But how do you accomplish this in any modern edition of D&D?
Let's say the party is level 5, and their goal is to rescue the princess from the evil wizard before he sacrifices her at midnight. She's being kept in the Dark Tower of Omens.
Outside of the tower, there are some orc guards. They have enough HP that they won't go down in one hit, but are unlikely to do much damage unless they score a critical hit. When the party defeats them, they are down some small number of HP (or they have spent one of their limited numbers of spells for the day); if they were reckless, or the orcs were lucky, then the party needs to spend more resources. Inside the tower, there are a number or rooms, filled with various amounts of traps and puzzles and enemies and treasures. After any encounter, they have the option of using spells to recover HP, or taking a short rest (which can only be done a limited number of times before the clock runs out, and may or may not be interrupted by a wandering monster).
The only "modern" edition where this doesn't work is 3.x, and even then, only if you make healing as cheap as the magic item and expected wealth tables suggests.