This is a very interesting question that I came across and have never solved any question of this sort. How do I find the largest open set on which $\frac{1}{cosz-2i}$ is analytic? Do I find the set in which $\cos z-2i\neq0$? Any answers will be much appreciated.
Note that $$\cos z=\frac{e^{iz}+e^{-iz}}{2}$$ where $z\in\mathbb{C}$
First, recall that $$ \cos(x+yi) = \cosh(y)\cos(x)-i\sinh(y)\sin(x). $$ If you haven't seen this before, it can be verified with a simple calculation.
So to have $\cos(x+yi)=2i$ we need to have $\cosh(y)\cos(x)=0$. Since $\cosh(y)>0$ for all $y$, we must have $\cos(x)=0$. Thus $x=\frac\pi2+\pi n$ for some $n\in\mathbb Z$ and therefore $\sin(x)=(-1)^n$.
Now we must have $\sinh(y)=-(-1)^n2$. Therefore $\cos(x+yi)=2i$ if and only if $x=\frac\pi2+\pi n$ for some $n\in\mathbb Z$ and $y=-(-1)^n\operatorname{arsinh}(2)$.