Yes a bomb can explode in space but the explosion would be different than it would be here on earth.
There was a nuclear bomb that exploded in space around 50 years ago and what happened is the debris from the nuclear bomb that exploded in space lingered in space for quite awhile.
Most of the debris in space from the bomb mainly lingered in space and was trapped by Earth's magnetic field, creating an artificial radiation belt high above our planet's surface.
So it is possible for a bomb to explode in space and there has been a bomb that exploded in space but the results of the explosion of the bomb in space was and is much different than how the bomb explodes and how it damages things here on earth.