As long as the chemical reaction, involved in the explosion which propels the bullet (or other missile) doesn't require the presence of oxygen (or any other gases) in air, there's no reason why a gun shouldn't work in a vacuum.
Gunpowder will explode without air. (I can guarantee that. When I was a teenager we used to build dams in a local stream, light bangers and then place them, underwater, to blow up the dams. The bangers still exploded underwater). Most other propellants which might be used, in a SF situation, also work whether or not air is present. (However, that's not true of all explosive substances. Your car engine runs because of repeated explosions of a petrol/air mix. An internal combustion engine wouldn't work in a vacuum).
So, it's likely that any SF gun would work in a vacuum.
Incidentally, if you read the 'Gunpowder' section, here:
http://www.du.edu/~jcalvert/tech/cannon.htm
you'll see that Captain Kirk doesn't know how to make the stuff ;-)
Chris