Note that $W$ is an $R$-invariant open subscheme of $U$. This is true because the set of points of $W$ is the set of points of $U$ which are equivalent in the sense of Groupoids, Lemma \ref{groupoids-lemma-pre-equivalence-equivalence-relation-points} to a point of $g(U') \subset U$ (the lemma applies as $j : R \to U \times_S U$ is a pre-equivalence relation by Groupoids, Lemma \ref{groupoids-lemma-groupoid-pre-equivalence}). Also $g : U' \to U$ factors through $W$. Let $R|_W$ be the restriction of $R$ to $W$. Then it follows that $R'$ is also the restriction of $R|_W$ to $U'$. Hence we can factor the map of sheaves of the lemma as $$ U'/R' \longrightarrow W/R|_W \longrightarrow U/R $$ By Groupoids, Lemma \ref{groupoids-lemma-quotient-groupoid-restrict} we see that the first arrow is an isomorphism of sheaves. Hence it suffices to show the lemma in case $g$ is the immersion of an $R$-invariant open into $U$. \medskip\noindent Assume $U' \subset U$ is an $R$-invariant open and $g$ is the inclusion morphism. Set $F = U/R$ and $F' = U'/R'$. By Groupoids, Lemma \ref{groupoids-lemma-quotient-pre-equivalence-relation-restrict} or \ref{groupoids-lemma-quotient-groupoid-restrict} the map $F' \to F$ is injective. Let $\xi \in F(T)$. We have to show that $T \times_{\xi, F} F'$ is representable by an open subscheme of $T$. There exists an fppf covering $\{f_i : T_i \to T\}$ such that $\xi|_{T_i}$ is the image via $U \to U/R$ of a morphism $a_i : T_i \to U$. Set $V_i = s_i^{-1}(U')$. We claim that $V_i \times_T T_j = T_i \times_T V_j$ as open subschemes of $T_i \times_T T_j$. \medskip\noindent As $a_i \circ \text{pr}_0$ and $a_j \circ \text{pr}_1$ are morphisms $T_i \times_T T_j \to U$ which both map to the section $\xi|_{T_i \times_T T_j} \in F(T_i \times_T T_j)$ we can find an fppf covering $\{f_{ijk} : T_{ijk} \to T_i \times_T T_j\}$ and morphisms $r_{ijk} : T_{ijk} \to R$ such that $$ a_i \circ \text{pr}_0 \circ f_{ijk} = s \circ r_{ijk}, \quad a_j \circ \text{pr}_1 \circ f_{ijk} = t \circ r_{ijk}, $$ see Groupoids, Lemma \ref{groupoids-lemma-quotient-pre-equivalence}. Since $U'$ is $R$-invariant we have $s^{-1}(U') = t^{-1}(U')$ and hence $f_{ijk}^{-1}(V_i \times_T T_j) = f_{ijk}^{-1}(T_i \times_T V_j)$. As $\{f_{ijk}\}$ is surjective this implies the claim above. Hence by Descent, Lemma \ref{descent-lemma-open-fpqc-covering} there exists an open subscheme $V \subset T$ such that $f_i^{-1}(V) = V_i$. We claim that $V$ represents $T \times_{\xi, F} F'$. \medskip\noindent As a first step, we will show that $\xi|_V$ lies in $F'(V) \subset F(V)$. Namely, the family of morphisms $\{V_i \to V\}$ is an fppf covering, and by construction we have $\xi|_{V_i} \in F'(V_i)$. Hence by the sheaf property of $F'$ we get $\xi|_V \in F'(V)$. Finally, let $T' \to T$ be a morphism of schemes and that $\xi|_{T'} \in F'(T')$. To finish the proof we have to show that $T' \to T$ factors through $V$. We can find a fppf covering $\{T'_j \to T'\}_{j \in J}$ and morphisms $b_j : T'_j \to U'$ such that $\xi|_{T'_j}$ is the image via $U' \to U/R$ of $b_j$. Clearly, it is enough to show that the compositions $T'_j \to T$ factor through $V$. Hence we may assume that $\xi|_{T'}$ is the image of a morphism $b : T' \to U'$. Now, it is enough to show that $T'\times_T T_i \to T_i$ factors through $V_i$. Over the scheme $T' \times_T T_i$ the restriction of $\xi$ is the image of two elements of $(U/R)(T' \times_T T_i)$, namely $a_i \circ \text{pr}_1$, and $b \circ \text{pr}_0$, the second of which factors through the $R$-invariant open $U'$. Hence by Groupoids, Lemma \ref{groupoids-lemma-quotient-pre-equivalence} there exists a covering $\{h_k : Z_k \to T' \times_T T_i\}$ and morphisms $r_k : Z_k \to R$ such that $a_i \circ \text{pr}_1 \circ h_k = s \circ r_k$ and $b \circ \text{pr}_0 \circ h_k = t \circ r_k$. As $U'$ is an $R$-invariant open the fact that $b$ has image in $U'$ then implies that each $a_i \circ \text{pr}_1 \circ h_k$ has image in $U'$. It follows from this that $T' \times_T T_i \to T_i$ has image in $V_i$ by definition of $V_i$ which concludes the proof.