If you are battling a hard trainer start a 2 0n 2 and select the pokemon that you are trying to train, followed by a pokemon that has a slightly lower level than the first one. Also make sure that your second pokemon can take hits well. The enemy pokemon will automatically attack the second pokemon only, so your higher level pokemon won't be targeted.
Also, if you have a dark type pokemon, it would be a good idea to train on "psycho" trainer, as none of his attacks will have any effect on your pokemon, meaning it can't be defeated as you slowly chip away at their health.
The same idea works with training flying types on "DiglettDude", you won't be hurt at all and you can train on high level pokemon from the start.