Would a gun work in space?
A conventional firearm would, under most circumstances, work perfectly well in space.
It’s true that there’s no oxygen in the abyss of space, but the firing of a gun doesn’t depend on oxygen even here on earth. Or, rather, it does, but not on the oxygen in the atmosphere.
The ammunition used in a typical gun consists of a bullet (the part that actually gets shot out of the gun), a casing filled with gunpowder (or cordite), and an explosive primer. The primer is ignited by the mechanical action of the hammer hitting its firing pin (or, in a rimfire cartridge, of the striker hitting the rim); this causes the powder to explode, sending the bullet flying down the barrel of the gun and out into the world. The gunpowder and explosive material in the primer already contain all the oxygen they need; they'll ignite and burn quite happily with no external source of 02. Consider how tightly a bullet is clamped into its casing how would free oxygen get in there anyway?
If anything, the absence of external air pressure in space would make the explosion of hot gas that propels the bullet out of its casing slightly more effective, although only by a negligible amount. And with no atmosphere to slow it down, the bullet would travel a lot further than it would on on earth: assuming it didn't hit Bruce Willis or anything else, it would continue on its merry way, driven by the force of the explosion, until acted upon by some other force e.g., the gravity of some very large body. (This means that if you want to maximize your bullet's distance traveled, you need to fire it somewhere in the deepest reaches of interstellar space, where there's nothing around to drag it to a halt.)
So the lack of oxygen likely wouldn't put a damper on outer-space gunplay. Temperature, on the other hand, could be a problem.
People typically think of space as cold, but in fact space, being a vacuum, essentially has no temperature at all. Objects in space may get very hot or very cold, depending on their proximity to the sun and their albedobasically, their tendency to reflect radiation rather than absorb it. It's certainly possible that a handgun way out in the middle of interstellar nowhere might become so cold that the gunpowder in the cartridge no longer reliably ignites and burns fast enough to produce an explosion. That’s not a result specifically of being in space, though, but simply of being very, very cold.