Conditional Expectation of function of two RVs, one measurable, one independent

As often with conditional expectations, to come back to the definition yields the solution. To check that $U=\mathrm E(f(X,Z)\mid \mathcal A)$ is to check that two conditions hold simultaneously: (1) $U$ is $\mathcal A$-measurable; (2) for every bounded and $\mathcal A$-measurable $Y$, one has $\mathrm E(UY)=\mathrm E(f(X,Z)Y)$.

Let us check (1) and (2) for $U=g(X)$ where $g$ is defined by $g(x)=\mathrm E(f(x,Z))$.

Since $U=g(X)$ is a measurable function of $X$ and $X$ is $\mathcal A$-measurable, $U$ is $\mathcal A$-measurable.

Now, $X$ and $Y$ are $\mathcal A$-measurable and $Z$ is independent on $\mathcal A$ hence $(X,Y)$ and $Z$ are independent. Calling $\mu$ the distribution of $(X,Y)$ and $\nu$ the distribution of $Z$, one gets $$ \mathrm E(f(X,Z)Y)=\iint f(x,z)\,y\,\mathrm d\mu(x,y)\,\mathrm d\nu(z). $$ On the other hand, $$ g(x)=\int f(x,z)\,\mathrm d\nu(z), $$ hence $$ \mathrm E(UY)=\mathrm E(g(X)Y)=\int g(x)\,y\,\mathrm d\mu(x,y)=\iint f(x,z)\,y\,\mathrm d\nu(z)\,\mathrm d\mu(x,y), $$ hence $\mathrm E(UY)=\mathrm E(f(X,Z)Y)$ by Fubini theorem. Finally, (1) and (2) hold for $U=g(X)$ hence $$ \mathrm E(f(X,Z)\mid \mathcal A)=g(X)=\int f(X,z)\,\mathrm dP_Z(z). $$ This means that $\mathrm E(f(X,Z)\mid \mathcal A)=U$ almost surely, where, for every $\omega$ in $\Omega$, $$ U(\omega)=\int f(X(\omega),z)\,\mathrm dP_Z(z). $$ Note: All this, and much more, is explained in a gem of a small book, highly accessible, titled Probability with martingales.