For example, take the common example $\frac{d}{dx}(\cos x) ^{\sin x}$. The usual method for this is
$$ y = (\cos x) ^{\sin x}\\ \ln y = \sin x \ln \cos x\\ \frac{d}{dx}\ln y = \frac{d}{dx} \sin x \ln \cos x\\ \frac{1}{y} \frac{dy}{dx} = \cos x \ln \cos x + \sin x \frac{1}{\cos x} \sin x\\ \frac{dy}{dx} = (\cos x) ^{\sin x} \left( \cos x \ln \cos x + \sin x \tan x \right) $$
Now, of course, $\ln \cos x$ isn't valid for all $x$. Does it mean that wherever $\ln \cos x$ is undefined, the derivative does not exist? Or am I incorrectly pre-assuming that I can take the natural logarithm of both sides in the first place?