Can we phase lock to a reference signal of square wave
The reference signal in a PLL needs to be appropriate for the type of phase discriminator used.

Most PLLs that are built use digital phase discriminators, so a square wave is the ideal waveform to use.

Even when using an analogue phase discriminator, for instance a DC-IF coupled double balanced mixer, a square wave works just as well as a sine wave.

A phase discriminator outputs a signal that's proportional to the difference in phase between the reference signal, and a fed-back signal representing the phase of the locked oscillator. It's just as easy to define the phase of a square wave as it is for a sine, triangle or pulse waveform. As long as this phase definition exists, and as long as the phase discriminator is sensitive to it, then a PLL can be closed successfully.