We are tasked with finding the limit:
\[
\lim_{x \to \frac{\pi}{2}} \left( \frac{\cos x}{x - \frac{\pi}{2}} \right)
\]
First, note that \( \cos \left( \frac{\pi}{2} \right) = 0 \), so both the numerator and denominator approach 0 as \( x \to \frac{\pi}{2} \). This gives us an indeterminate form \( \frac{0}{0} \), and we can apply L'Hopital’s Rule to evaluate the limit.
Taking the derivative of the numerator and denominator:
- The derivative of \( \cos x \) is \( -\sin x \).
- The derivative of \( x - \frac{\pi}{2} \) is simply 1.
Thus, applying L'Hopital’s Rule:
\[
\lim_{x \to \frac{\pi}{2}} \frac{\cos x}{x - \frac{\pi}{2}} = \lim_{x \to \frac{\pi}{2}} \frac{-\sin x}{1}
\]
Since \( \sin \left( \frac{\pi}{2} \right) = 1 \), we get:
\[
\lim_{x \to \frac{\pi}{2}} \frac{-\sin x}{1} = -1
\]
Thus, the value of the limit is \( -1 \), and the correct answer is option (B).