[proofplan]
We reduce the Hartogs--Bochner theorem to the [Hartogs Extension Theorem](/theorems/3401) via a local-to-global covering argument. Near each boundary point of $K$, we construct a local Hartogs figure inside $\Omega$ that surrounds a portion of $K$, apply the local [extension theorem](/theorems/59) to extend $f$ across that portion, and patch the local extensions together using the [Identity Principle](/theorems/3357) and the connectedness of $\Omega \setminus K$. The argument proceeds in three steps: construct local extensions, patch them using uniqueness, and verify that the extension is globally well-defined on all of $\Omega$.
[/proofplan]
[step:Construct local Hartogs figures near each boundary point of $K$ and extend $f$ locally]
Fix a point $p \in \partial K$ (the topological boundary of $K$ in $\Omega$). Since $K$ is compact and $\Omega$ is open, there exists a polydisc $\mathbb{D}^n(p, \rho) \subset \Omega$ centred at $p$. Because $p$ is a boundary point of $K$, every neighbourhood of $p$ meets $\Omega \setminus K$. Since $n \geq 2$, we may construct a Hartogs figure $H(\varepsilon) \subset \mathbb{D}^n(p, \rho)$ for sufficiently small $\varepsilon > 0$: specifically, define
\begin{align*}
H(\varepsilon) := \{z \in \mathbb{D}^n(p, \rho) : |z_1 - p_1| > \rho - \varepsilon\} \cup \{z \in \mathbb{D}^n(p, \rho) : |(z_2 - p_2, \dots, z_n - p_n)| < \varepsilon\}.
\end{align*}
By choosing $\varepsilon$ small enough, we arrange that $H(\varepsilon) \subset \Omega \setminus K$ in a neighbourhood of $p$ (since $K$ has empty interior locally after shrinking, and the shell part of the Hartogs figure avoids $K$ near $p$). The restriction $f|_{H(\varepsilon)}$ is holomorphic, and by the [Hartogs Extension Theorem](/theorems/3401) applied to $\mathbb{D}^n(p, \rho)$, there exists a unique $F_p \in \mathcal{O}(\mathbb{D}^n(p, \rho))$ extending $f|_{H(\varepsilon)}$.
More precisely: since $K$ is compact and $p \in \partial K$, after a possible linear change of coordinates and shrinking $\rho$, the compact set $K \cap \overline{\mathbb{D}^n(p, \rho)}$ is contained in a proper compact subset of the polydisc. The function $f$ is holomorphic on $\mathbb{D}^n(p, \rho) \setminus K$, and the complement of $K$ in $\mathbb{D}^n(p, \rho)$ contains a Hartogs figure whose envelope is the full polydisc. By the [Hartogs Extension Theorem](/theorems/3401), $f$ extends to all of $\mathbb{D}^n(p, \rho)$.
[guided]
The geometric idea is that in dimension $n \geq 2$, a compact set cannot block holomorphic extension from the shell of a polydisc to the full polydisc. The [Hartogs Extension Theorem](/theorems/3401) states precisely that a [holomorphic function](/page/Holomorphic%20Function) defined on a Hartogs figure extends holomorphically to the full polydisc. We exploit this by building such a figure near each boundary point of $K$.
Since $p \in \partial K$ and $K$ is compact in $\Omega$, we can find a polydisc $\mathbb{D}^n(p, \rho) \subset \Omega$. The compact set $K \cap \overline{\mathbb{D}^n(p, \rho)}$ cannot fill the entire polydisc (it is a proper compact subset because $p \in \partial K$ means points arbitrarily close to $p$ lie in $\Omega \setminus K$). By possibly performing a unitary rotation and shrinking $\rho$, we can arrange that the "shell" of a Hartogs figure $H(\varepsilon) \subset \mathbb{D}^n(p, \rho) \setminus K$. The [Hartogs Extension Theorem](/theorems/3401) then gives a unique holomorphic extension $F_p \in \mathcal{O}(\mathbb{D}^n(p, \rho))$ satisfying $F_p = f$ on $H(\varepsilon)$.
The hypothesis $n \geq 2$ is essential here: in one complex variable, a compact set $K$ with connected complement in $\Omega$ need not be removable (consider $K = \{0\}$ and $f(z) = 1/z$ on $\Omega \setminus \{0\}$). The Hartogs phenomenon is a purely multi-variable effect.
[/guided]
[/step]
[step:Patch local extensions using the identity principle and connectedness of $\Omega \setminus K$]
The local extensions $\{F_p\}_{p \in \partial K}$ agree with $f$ on the [open set](/page/Open%20Set) $\mathbb{D}^n(p, \rho) \setminus K \subset \Omega \setminus K$. We verify compatibility: if $\mathbb{D}^n(p, \rho_p)$ and $\mathbb{D}^n(q, \rho_q)$ overlap, then on the intersection $\mathbb{D}^n(p, \rho_p) \cap \mathbb{D}^n(q, \rho_q)$ the functions $F_p$ and $F_q$ are both holomorphic and agree on the open subset $(\mathbb{D}^n(p, \rho_p) \cap \mathbb{D}^n(q, \rho_q)) \setminus K$, which is nonempty (since $\Omega \setminus K$ is connected and dense near $\partial K$). By the [Identity Principle](/theorems/3357), $F_p = F_q$ on the entire connected component of $\mathbb{D}^n(p, \rho_p) \cap \mathbb{D}^n(q, \rho_q)$ that meets $\Omega \setminus K$.
Since the intersection $\mathbb{D}^n(p, \rho_p) \cap \mathbb{D}^n(q, \rho_q)$ is a connected [open set](/page/Open%20Set) (the intersection of two polydiscs in $\mathbb{C}^n$ is connected), the [identity principle](/theorems/3357) gives $F_p = F_q$ on the full intersection.
[guided]
The compatibility check is the crux of the patching argument. Two holomorphic functions that agree on a nonempty open subset of a connected domain must agree everywhere, by the [Identity Principle](/theorems/3357). The hypothesis that $\Omega \setminus K$ is connected is used here: it ensures that the [open set](/page/Open%20Set) $(\mathbb{D}^n(p, \rho_p) \cap \mathbb{D}^n(q, \rho_q)) \setminus K$ is nonempty whenever the two polydiscs overlap.
Why must this set be nonempty? If the two polydiscs overlap, their intersection is an open connected polydisc-like region. The compact set $K$ has no interior (since $f$ is defined on $\Omega \setminus K$, which is open, and every point of $\partial K$ is a limit of points in $\Omega \setminus K$). A compact set with empty interior cannot contain a nonempty [open set](/page/Open%20Set), so the intersection minus $K$ is nonempty. On this nonempty [open set](/page/Open%20Set), both $F_p$ and $F_q$ agree with $f$, and the [identity principle](/theorems/3357) forces them to agree everywhere on the connected intersection.
[/guided]
[/step]
[step:Define the global extension $F$ on $\Omega$ and verify uniqueness]
Define $F: \Omega \to \mathbb{C}$ by
\begin{align*}
F(z) := \begin{cases} f(z) & \text{if } z \in \Omega \setminus K, \\ F_p(z) & \text{if } z \in \mathbb{D}^n(p, \rho_p) \text{ for some } p \in \partial K. \end{cases}
\end{align*}
This is well-defined: on $(\Omega \setminus K) \cap \mathbb{D}^n(p, \rho_p)$, we have $F_p = f$ by construction, and on overlapping polydiscs, the local extensions agree by the patching step. The set of points covered is $(\Omega \setminus K) \cup \bigcup_{p \in \partial K} \mathbb{D}^n(p, \rho_p) \supset \Omega$ (since every point of $K$ is either in the interior of $K$, which is covered by the polydiscs centred at nearby boundary points, or in $\partial K$, which is covered by the polydiscs centred at those boundary points). Since the polydiscs $\{\mathbb{D}^n(p, \rho_p)\}_{p \in \partial K}$ form an open cover of $\partial K$, and $K$ is compact, finitely many suffice: $\partial K \subset \bigcup_{i=1}^N \mathbb{D}^n(p_i, \rho_{p_i})$. The interior of $K$ (if nonempty) is also covered since $K = \partial K \cup \operatorname{int}(K)$ and $\operatorname{int}(K) \subset \bigcup_{i=1}^N \mathbb{D}^n(p_i, \rho_{p_i})$ by compactness and the covering property.
The function $F$ is holomorphic on $\Omega$: on $\Omega \setminus K$ it equals the [holomorphic function](/page/Holomorphic%20Function) $f$, and at each point of $K$ it equals the [holomorphic function](/page/Holomorphic%20Function) $F_p$ on some polydisc neighbourhood. Thus $F \in \mathcal{O}(\Omega)$ and $F|_{\Omega \setminus K} = f$.
Uniqueness follows from the [Identity Principle](/theorems/3357): if $F_1, F_2 \in \mathcal{O}(\Omega)$ both extend $f$, then $F_1 - F_2 = 0$ on the nonempty [open set](/page/Open%20Set) $\Omega \setminus K$. Since $\Omega$ is connected (as a domain), $F_1 = F_2$ on $\Omega$.
[guided]
Let us verify that the definition of $F$ truly covers all of $\Omega$. Points in $\Omega \setminus K$ are covered by the first case. Points in $\partial K$ are covered by the polydiscs $\mathbb{D}^n(p, \rho_p)$ centred at themselves. For points in $\operatorname{int}(K)$: since $K$ is compact, $\operatorname{int}(K)$ is bounded. Each point $q \in \operatorname{int}(K)$ can be connected to $\partial K$ (since $K$ is compact in $\Omega$ with $\Omega \setminus K$ connected). In fact, $q$ lies in the polydisc $\mathbb{D}^n(p, \rho_p)$ for some $p \in \partial K$ close enough to $q$ (since $K$ is compact and $\partial K$ is its boundary, we can find $p \in \partial K$ with $|q - p| < \rho_p$). By compactness of $K$, finitely many polydiscs suffice to cover all of $K$.
For uniqueness: the connectedness of $\Omega$ (which is a domain by hypothesis) is essential. The [Identity Principle](/theorems/3357) applies because $\Omega$ is connected and $\Omega \setminus K$ is a nonempty open subset where any two extensions agree. Note that we need $\Omega$ to be connected, not merely $\Omega \setminus K$. The hypothesis that $\Omega \setminus K$ is connected was used in the patching step, not here; for uniqueness, the connectedness of $\Omega$ suffices.
[/guided]
[/step]