Is it possible for NPC trainers to have a shiny Pokémon?
If you mean a random shiny then no, NPC trainers always have predefined Pokemon.
The only case I've battled shinies was at the Trainer Tower in Pokemon FireRed/LeafGreen.
From Bulbapedia:
The Trainer Tower has three Trainers who use Shiny Pokémon: Burglar Jac has a Meowth, Twins Jen and Kira have an Espeon, and Fisherman Kaden has a Seaking.
In the Single Battle mode, the seventh Trainer has a Shiny Meowth, while in Double Battle mode, the first pair of Trainers have a Shiny Espeon. Finally, in the knockout mode, the fourth Trainer will send out a Shiny Seaking.
Here's also a video proof of shiny Espeon.
From Trivia here
There's some NPC Trainer that can be found with shiny pokemon.
- The Minccino that appears in the "world of Pokémon" intro in Pokémon Black and White.
- Rental Pokémon found in the Battle Factory in Pokémon Emerald.
- Battle Frontier Pokémon used by the AI in Pokémon Platinum.
- The Ralts that Wally catches in Pokémon Ruby, Sapphire, and Emerald.
There's also shiny pokemon that can be found not in the wild,
- The Pokémon that the old man encounters in FireRed and LeafGreen.
- The Poochyena/Zigzagoon that attacks Professor Birch in Pokémon Ruby, Sapphire, and Emerald.
- The Purrloin that Bianca catches in Pokémon Black 2 and White 2.
- The Fletchling that the rival, Calem or Serena, uses in the capture tutorial in Pokémon X and Y.
Other than that, what pinckerman Said is true and I'm also think that NPC trainers always have predefined Pokemon.
Excluding trainers that always have shinies, yes a trainer can have a shiny Pokémon if and only if the Pokémon that they have are randomized. Most trainers in the games have a predetermined set of Pokémon and this won't happen to them, but in certain cases, NPCs will have a random set of Pokémon.
This actually happened to me. I was going through the Battle Tower in Gen IV and my opponent had a shiny Girafarig, the only shiny I had seen in my 400+ hours of playing the game. Needless to say, it was a frustrating experience that I would not forget.