Ak spray or get some distance on them. If you get cornered though you are basically fucked unless your reflexes are fast enough to withstand the full force of a scrub barrel.
If you manage to see them from a distance keep distance between yourself and them and keep in mind where you're going. If they follow you for a bit and they're probably going to close the gap, then t-bait them slightly. You'll probably get a reaction out of it.
Here's some tips: Keep your distance. - Stay as far away from them as possible. - Stay out of cramped or narrow areas. - Stay away from doors and corners. Kill them quickly. - Shoot them with a powerful gun. - Shoot them from behind. - Shoot them in the head.
Psychologically destroy them by calling them noob shotgun bitch and force them to switch to a different weapon.
Do your best, and don't be like: *DEAD* Zuko: FUCK THIS SHOTGUN USING LIL BITCH ASS I FUCKING HATE THAT THING WHAT THE ACTUAL FUCK WHY DON'T THEY JUST NERF THIS PIECE OF FUCKING SHIT
What @MonkeyBoy says is true, you should keep distance if you can. You can both actively try to keep distance (for example, if you know there is a shotgunner in the corner inside the room, then choose the entrance and approach that keeps your distance away from him) and passively try to keep distance (move backward while shooting). But if you can't keep distance, I find that sometimes the best option is just to stay right next to the shotgun. This might sound counter-intuitive, but hitbox is very bad when two players are standing next to each other, and player has to turn his mouse more when the other player is closer. I have tried this sometimes in enclosed place like elevator and it worked.