There's no two ways about it: space is trying to kill you. Between the no breathable air, radiation, and rocks hurling around everywhere, space is a human hazard. Yet we continue to push boundaries and explore this perilous place. And it's miraculous that in more than 50 years of human spaceflight only three men have died in space.
So the caveat here is that it all depends on how you define space. If we want to get technical, space starts at the Kármán Line, an imaginary line 62 miles above the planet because we need some way to determine what's space and what isn't. By that formal definition, most of the fatalities in spaceflight haven't happened in space.
However, three men have died in space, albeit during reentry, not in orbit on a mission. The crew of Soyuz 11 were killed on June 30, 1971, above the Kármán line. This happened when a valve opened at the top of the descent module, letting the pressurized atmosphere escape. The open valve exposed them to the vacuum of space, killing the crew in under a minute. The spacecraft, meanwhile, executed a flawless automatic landing. They were found unresponsive with blue patches on their faces and blood dripping from their noses and ears but one was still warm to the touch.
But aside from those three cosmonauts, no one else has died in space in 40 years. How is that possible?