The key to this puzzle is that you need to draw five separate loops, each one enclosing the sheep of one of the five colors (if you try to solve the puzzle with one loop containing all the sheep, you'll arrive at contradiction, and then you might consider the third rule and notice that the rules never specify only one loop). The solution is:
Counting the number of squares in each loop, converting that number to a letter, and ordering by rainbow order (red=6=F, etc.) gives the answer FENCE.