40d:Dwarf cancels task: Dangerous terrain
This means that the path a dwarf has chosen has become occupied with deep water or magma - dwarves never attempt to path through such terrain under normal circumstances. It can also occur if a dwarf, often whilst hunting, falls more than one z-level.
In some cases a dwarf may happily wade into a pool of water to drink, only to realize the depth after entering, leading to "Dwarf cancels Drink: Dangerous terrain".
It can also mean the dwarf is currently in dangerous terrain, and is canceling a job on the other side of the map or that the dwarf requires building materials that are at the bottom of a lake or river.
Fortresses with waterfalls above high traffic areas or meeting areas can generate these messages with annoying frequency, though it can be amusing to see "Dwarf cancels Attend Party: Dangerous terrain" when a partygoer steps underneath the waterfall in your dining room or sculpture garden.