There are a few ways to do this, depending on your situation.
Do you require pathfinding, or are they free to run straight away from you?
I'm assuming you already have a system in place to have the baddies run towards you. How are you doing this?
Try having invisible "flee target" spots around the level. When they need to flee, pathfind to the one closest to them and farthest from the player. Or something along those lines. You'll probably need to add some conditions to ensure they don't flee towards a spot that the player is already along the path to.
You can use another invisible "avoid zone" around the player for that. When your baddie picks a spot to flee, draw a line between that spot and the baddie to see if it collides with the avoid zone. If it does, that means the player is in the way and it should probably go somewhere else.
Along the lines of the "avoid zone", you could probably update it as a solid in terms of pathfinding every once in a while, then the baddie using pathfinding definitely won't go there.