I'll refer to Hartogs' Extension Theorem as it is stated in Wikipedia (https://en.wikipedia.org/wiki/Hartogs%27_extension_theorem#Formal_statement).
I am trying to find a counterexample to show that the hypothesis that $\Omega/K$ is connected is a necessary condition.
What I've tried so far is to work with the following example. Let $\Omega$ be the unit open ball in $C^2$ and for $(z_1, z_2)\in\Omega$, let $f$ be the function defined as $f(z_1, z_2)=\dfrac{z_2}{z_1}$. If $K=\{z_1=0\}$, then $K$ is relatively compact in $\Omega$, with $\Omega/K$ disconnected and $f$ holomorphic in $\Omega/K$.
What is the most adequate way to show that $f$ does not extend holomorphically over $K$? My initial idea was that, if $f$ extends to $\tilde{f}$ holomorphically over $K$, then I can compose it with the holomorphic mapping $\gamma(z)=(z,1)$ for $z$ complex with $|z|<1$, to obtain, $(\tilde{f}\circ \gamma)(z)=\dfrac{1}{z}$ for every $z$ with $0<|z|<1$ which should be holomorphic (as composition of holomorphic functions) and extend holomorphically over $z=0$ (since $f$ does), but it's not at $z=0$ and does not extend holomorphically over $z=0$.
Is this Ok?
Why do you think that $\Omega \setminus K$ is not connected? (It is.) On the other hand $K$ is not compact (or relatively compact) in $\Omega$, so it's not clear to me what you are trying to do.
On the other hand, your $f$ doesn't extend to $\Omega$. I think the shortest way to see this is that $z_1 f = z_2$ on $\Omega \setminus K$, so if $f$ extends holomorphically to $\Omega$, then $z_1 f = z_2$ on the whole of $\Omega$ (by the identity theorem), but this is impossible (at points where $z_1 = 0 \neq z_2$).
A better counterexample would be $\Omega$ as the unit ball in $\mathbb{C}^2$ and $K = \{ |z_1|^2 + |z_2|^2 = 1/2 \}$ which disconnects $\Omega$ into $\Omega_1 = \{ |z_1|^2 + |z_2|^2 < 1/2 \}$ and $\Omega_2 = \{ 1/2 < |z_1|^2 + |z_2|^2 < 1 \}$. The function $f$ which is $0$ on $\Omega_1$ and $1$ on $\Omega_2$ is holomorphic on $\Omega \setminus K = \Omega_1 \cup \Omega_2$ but clearly can't be extended holomorphically to $\Omega$.