The singularity at the denominator can be eliminated using L'Hospital's theorem, once you notice that the associated Legendre function has value of $0$ at $\pm 1$.
* * *
Maybe this is not a right solution, because I found another formula about the derivative of the associated Legendre function here,
* Spherical Harmonics
and it gives a difference solution when I apply the same method.