How would a spaceship traveling through interplanetary space, let's say to Mars, avoid all the space debris or there isn't any interplanetary space debris at all, is it only orbital debris around the earth?
Space is in general an empty place, and debris is only a problem in Earth orbit. Even there, the amount of debris is only considerable in popular orbits like GEO. The reason is in part that there have only been a two digit number of probes sent away from Earth's influence, compared to the thousands of satellites currently orbiting Earth.
The other part of the reason is the vast size of interplanetary space. Near Earth space is measured in thousands of kilometres, interplanetary space in millions. The volume of a cube with sides a thousand times longer is a billion times as big. The debris is therefore so scattered that we do not actually have to pay attention to it.
However, not all small objects out there are man-made, a lot of them are natural rocks and gravel. They are too small to observe from Earth.
To answer your question about how to avoid them, you really can't. We have no way of detecting them, and spacecraft in interplanetary space are mostly on a predetermined course just coasting without changing their orbit.
Shielding is an option though, mostly protecting from very small particles. To shield from larger ones, you would need a heavier shield, eating into your spacecraft mass budget. A bit more about micro meteorite shielding can be found here.
Universe today has some excellent visualisations of the orbital debris problem.
Damage on shuttle after micrometeorite impact