Will cutting section of 2x4 reduce strength
1: Yes it will reduce the strength and depending on how you cut it will determine how much and to what catastrophic point it will fail. A Drilled hole for line of sight is one thing a cut out is another.

The following two comments do not directly answer your question but need to be stated. I am not trying to hurt anyone's feelings by posting them just trying to provide some constructive feedback and I am saying ti because someone needs to say something to help you.

2: That protrusion of 2 x 4's from the ceiling down - that is a terrible (atrocious) mounting for a garage door opener installation! The 2 x 4 should be mounted between above the ceiling between the rafters then your metal mounting for the opener should be on the ceiling side mounted to that 2 x 4  - taking up minimal space and would not be such an eye sore. Of course if this part was done right you would not be asking your question here about your motion sensor.

3: I see that free romex wire running down and I am assuming it is rigged to an electrical outlet for the opener or maybe hooked to it directly - I will state this if you are in the USA ..it is a code violation. You should have that fixed and done right too - install an outlet box in the ceiling and plug your opener power cord into it.

I am not trying to be snobby or anything like that .. normally I don't answer this way but in this case I feel compelled to so that perhaps you will make it right and will not have any issues in the future, especially with your wiring .. like perhaps a fire!  

EDIT 3-29-2018 Wiring fix: