Ceiling Fan Pancake Box Install
You can notch a joist up to 1/6 the depth of the joist. For example, a 2x10 can be notched 1.54166" deep (9 1/4" / 6). However, you cannot notch a joist within the middle 1/3 of the joists length. The notch can also only be 1/3 the depth of the joist wide. Again with the 2x10 example, that means the notch can only be 3.0833" wide (9 1/4" / 3).

Since ceiling fans tend to be near the middle of the room, it's likely that the intended notch location is within the middle third of the joist. Which means that notching the joist, could be dangerous.

You also cannot notch the joist if it's an engineered joist, without consulting the manufacturer or an engineer first. 

For more information on notching and boring joists, please se.e this answer