Consider function $f\left(x\right)\:=\:\tan\left(3x-\pi \right)$. I know that $\tan$ is undefined at $\frac{\pi}{2}+\pi k,\:k\in\mathbb{Z}$. I solved $3x-\pi=\frac{\pi}{2}$, which means that $x$ must never be $\frac{\pi}{2}$.
However, the proposed solution for this problem is $\left\{x\in \mathbb{R}:x\:\text{is different from}\:\frac{\pi }{6}+\frac{k\pi }{3},\:k\in \mathbb{Z}\right\}$. I can't quite understand this conclusion.
You are correct that $3x-\pi\neq \frac\pi 2$. However, the equation you should solve is $3x-\pi = \frac\pi 2 + \pi k$ for $k\in\Bbb Z$. This becomes $3x=\frac{3\pi}2+\pi(k+1)$ and so $x=\frac\pi 2+\frac\pi 3(k+1)$. Now, suppose $n-2=k$. As $k$ is just some arbitrary integer, $n$ is also just an arbitrary integer so we still have all the same solutions. Substitutin gives that $x=\frac\pi 2 +\frac\pi 3(n-2+1)=\frac\pi 2 + \frac\pi 3(n-1)= \frac\pi 2 -\frac\pi 3 + \frac\pi 3n = \frac\pi 6+\frac\pi 3 n$ for $n\in\Bbb Z$.