[step:Stop inside the domain and cancel the killed drift]
Fix $x\in U$, and let $v\in C(\overline U)\cap C^2(U)$ be the bounded classical solution from the hypothesis. For each sufficiently large $k\in\mathbb N$ with $x\in U_k$, define
\begin{align*}
U_k:=\{y\in U:\operatorname{dist}(y,\partial U)>1/k\}
\end{align*}
and the interior exit time
\begin{align*}
\tau_k:\Omega&\to[0,\infty]\\
\omega&\mapsto \inf\{t\ge0: W_t(\omega)\notin U_k\}.
\end{align*}
The sets $U_k$ increase to $U$, and continuity of Brownian paths gives $\tau_k\uparrow\tau_U$ almost surely.
For $t\ge0$, define the stopped killing functional
\begin{align*}
A_{k,t}:\Omega&\to[0,\infty)\\
\omega&\mapsto \int_0^{t\wedge\tau_k(\omega)}q(W_s(\omega))\,d\mathcal L^1(s).
\end{align*}
This definition only evaluates $q$ while $W_s\in U_k\subset U$. Fix $T>0$. Since $\overline{U_k}$ is compactly contained in $U$, the functions $v$, $\nabla v$, $\Delta v$, and $q$ are bounded on $\overline{U_k}$. Choose an open set $V_k$ with $\overline{U_k}\subset V_k\Subset U$. A $C^2$ extension of $v|_{V_k}$ to $\mathbb R^n$ agrees with $v$ on $V_k$, so [Itô's Formula](/theorems/2099) applies to the stopped path up to $\tau_k$.
Define
\begin{align*}
Y_{k,t}:\Omega&\to\mathbb R\\
\omega&\mapsto \exp(-A_{k,t}(\omega))\,v(W_{t\wedge\tau_k(\omega)}(\omega)).
\end{align*}
The finite-variation product rule and [Itô's formula](/theorems/2099) give, for $0\le t\le T$,
\begin{align*}
Y_{k,t}
=v(x)
&+\int_0^{t\wedge\tau_k}\exp(-A_{k,s})\nabla v(W_s)\cdot dW_s\\
&+\int_0^{t\wedge\tau_k}\exp(-A_{k,s})
\left(\frac12\Delta v(W_s)-q(W_s)v(W_s)\right)\,d\mathcal L^1(s).
\end{align*}
For $s<\tau_k$, the point $W_s$ lies in $U$, and the PDE gives
\begin{align*}
\frac12\Delta v(W_s)-q(W_s)v(W_s)=0.
\end{align*}
Therefore
\begin{align*}
\exp(-A_{k,t})v(W_{t\wedge\tau_k})
=v(x)+\int_0^{t\wedge\tau_k}\exp(-A_{k,s})\nabla v(W_s)\cdot dW_s.
\end{align*}
The stopped integrand is bounded and progressively measurable on $[0,T]$, so the stochastic integral is a square-integrable martingale with expectation zero. Taking expectations at $t=T$ yields
\begin{align*}
v(x)=\mathbb E^x\left[\exp(-A_{k,T})v(W_{T\wedge\tau_k})\right].
\end{align*}
[/step]