Consider a random $n\times n$ real matrix $\Sigma$ on a measure space $(\Omega,\mathcal F)$. Let $\ker(\Sigma)$ denote its random null space. If $f:(\Omega,\mathcal F)\to\mathbb R^n$ is a Borel measurable map, can one show the existence of a Borel measurable map $\mathcal g:(\Omega,\mathcal F)\to\mathbb R^n$ such that, for all $\omega\in\Omega$,
$$g(\omega)= P_{\ker(\Sigma(\omega))}\,f(\omega)$$
where $P_{U}\,v$ denotes the orthogonal projection of $v$ onto the subspace $U$ ?
Thanks for your help.
EDIT: I made an attempt below. Any feedback is very appreciated.
Let $M_n$ denote the space of $n\times n$ real matrices endowed with the Frobenius matrix norm. Let $\mathcal B(M_n)$ denote the Borel $\sigma$-algebra on $M_n$. Since $M_n$ is homeomorphic with $\mathbb R^{n^2}$ there is a bijection between $\mathcal B(M_n)$ and $\mathcal B(\mathbb R^{n^2})$.
I will try to show that the map $(\Sigma,v) \mapsto P_{\ker(\Sigma)}v$ from $(M_n\times \mathbb R^n,\mathcal B(M_n) \otimes \mathcal B(\mathbb R^{n^2}))$ to $(\mathbb R^n,\mathcal B(\mathbb R^n))$ is measurable. The result will then follow by composing with the measurable map $\omega\mapsto (\Sigma(\omega),f(\omega)$).
The idea is to apply a principle of measurable choice as stated here. To this end let $X=M_n\times \mathbb R^n $, $Y=(\mathbb R^n)^3$ and define
$$E=\bigg\{\big(\Sigma,v,u,w,x\big)\in X\times Y: v=u+w,u=\Sigma^\top x, \Sigma w=0 \bigg \}$$
Since a finite product of separable spaces is separable, we have that $X,Y$ are separable metric spaces. Using the sequential characterization of a closed set in a metric space and continuity of matrix multiplication, we see that $E$ is a closed subset of $X\times Y$. Since $X\times Y$ is homeomorphic with $\mathbb R^{n^2+4n}$, it is $\sigma$-compact. Closed subsets of $\sigma$-compact spaces are also $\sigma$-compact, so $E$ is $\sigma$-compact.
The principle of measurable choice therefore provides us with a Borel function $\varphi :\pi_X(E)\to Y$ whose graph is contained in $E$, where $\pi_X$ denotes the projection on $X$.
Note that $\pi_X(E)=X$, because $\mathbb R^n = \ker(\Sigma) \oplus \text{range}(\Sigma^\top)$. Moreover we have
$$\varphi_1(\Sigma,v)=P_{\text{range}(\Sigma^\top)}v$$
$$\varphi_2(\Sigma,v)=P_{\ker(\Sigma)}v$$
where $\varphi_1,\varphi_2$ denote the first and second component functions of $\varphi$, which are Borel measurable since $\varphi$ is.
The final thing to check is that $\mathcal B(X)=\mathcal B(M_n) \otimes \mathcal B(\mathbb R^{n^2})$, but this follows from the fact that $M_n$ and $\mathbb R^{n^2}$ are separable.