Detecting if a path is unreachable

Lets say my AIController has been assigned the task of moving to a player whom is surrounded by impassable walls.
Naturally, the AI does not know that it cannot get inside, so is there any way of checking if this task will fail (preferably before executing any sort of movement)?