There are a few recovery mechanisms, for example, recovery of par (i.e., the notional), recovery of treasury (i.e., the recovery value is a constant fraction of the equivalent default-free bond), and recovery of market value (i.e., a fraction of its pre-default market value). Here, your formula, which is also called the Lando formula, assumes the recovery of market value mechanism.
Let $V_t$ be the pre-default value at time $t$ of the zero-coupon bond with maturity $T$ and unit face value (note that $V_T=1$). Moreover, let $R$ be the recovery rate, of the pre-default value $V_{\tau}$. Furthermore, let $\tau$ be the default time, $H_t=\pmb{1}_{\{\tau \leq t\}}$. Let $\mathscr{F}_t$ be the market information set at time $t$ (which roughly speaking includes all information other than the fact of default or survival). Moreover, let $\mathscr{H}_t = \sigma(H_u,\, u \leq t)$ and $\mathscr{G}_t = \mathscr{F}_t \vee \mathscr{H}_t$ be the enlarged information set. Here, we can assume that the default time $\tau$ is defined as the first jump time of an in-homogeneous Poisson process, where the intensity process $\{h_t,\, t \ge 0\}$ is deterministic, or a Cox process, where the intensity is stochastic (see Bielecki and Rutkowski for more details).
Generally, we assume that the $\mathscr{H}$-condition is satisfied, that is, $\mathscr{H}_t$ and $\mathscr{F}_{\infty}$ are independent conditioned on $\mathscr{F}_t$; in other words, for any $\mathscr{H}_t$-measurable random variable $X$ and $\mathscr{F}_{\infty}$ measurable random variable $Y$,
\begin{align*}
E(XY\,|\,\mathscr{F}_t) = E(X\,|\,\mathscr{F}_t)E(Y\,|\,\mathscr{F}_t).
\end{align*}
The other key formula to use is the filtration switching formula (see the book Interest Rate Models - Theory and Practice): For any $\mathscr{G}_{\infty}$ measurable random variable $Y$,
\begin{align*}
E\left(\pmb{1}_{\{\tau > t\}}Y\,|\,\mathscr{G}_t\right) = \pmb{1}_{\{\tau > t\}}\frac{E\left(\pmb{1}_{\{\tau > t\}}Y\,|\,\mathscr{F}_t\right)}{E\left(\pmb{1}_{\{\tau > t\}}\,|\,\mathscr{F}_t\right)}.\tag 1
\end{align*}
Then, for $0 \leq t < T$,
\begin{align*}
\pmb{1}_{\{\tau > t\}}V_{t} &= E\bigg(\pmb{1}_{\{\tau > T\}}e^{-\int_{t}^{T} r_s ds} + \pmb{1}_{\{t< \tau \le T\}} R\, V_{\tau}e^{-\int_{t}^{\tau} r_s ds} \, \big|\, \mathscr{G}_{t}\bigg) \\
&=\pmb{1}_{\{\tau > t\}} E\bigg(e^{-\int_{t}^{T} (r_s+h_s) ds} + \int_{t}^{T}R\, V_{u}h_u e^{-\int_{t}^{u} (r_s+h_s) ds} du \, \big|\, \mathscr{F}_{t}\bigg) \tag 2 \\
&=\pmb{1}_{\{\tau > t\}} e^{\int_0^{t} (r_s+h_s) ds} E\bigg(e^{-\int_0^{T} (r_s+h_s) ds} + \int_{t}^{T}R\, V_{u} h_u e^{-\int_0^{u} (r_s+h_s) ds} du \, \big|\, \mathscr{F}_{t}\bigg). \nonumber
\end{align*}
Here, the $\mathscr{H}$-condition and the filtration switching formula are employed in the derivation of $(2)$.
Let
\begin{align*}
M_t = E\bigg(e^{-\int_0^{T} (r_s+h_s) ds} + \int_0^{T}R\, V_{u}h_u e^{-\int_0^{u} (r_s+h_s) ds} du \, \big|\, \mathscr{F}_t\bigg).
\end{align*}
Then, $M_t$ is a martingale. Moreover,
\begin{align*}
V_t = e^{\int_0^t (r_s+h_s) ds}\bigg(M_t - \int_0^{t} R\,V_{u}h_u e^{-\int_0^{u} (r_s+h_s) ds} du \bigg).
\end{align*}
By Ito's lemma,
\begin{align*}
d\Big(e^{-\int_0^t (r_s+(1-R)h_s) ds} V_t \Big) = e^{\int_0^t R\, h_s ds} dM_t.
\end{align*}
Since $M_t$ is a martingale, $e^{-\int_0^t (r_s+(1-R)h_s) ds} V_t$ is also a martingale over $[0, T]$. Then, for any $0\le t \le u\le T$,
\begin{align*}
e^{-\int_0^t (r_s+(1-R)h_s) ds} V_t = E\Big(e^{-\int_0^u (r_s+(1-R)h_s) ds} V_u \, \big|\, \mathscr{F}_t \Big).
\end{align*}
In particular,
\begin{align*}
V_0 = E\left(e^{-\int_0^{T} (r_s+(1-R)h_s) ds}\right).
\end{align*}