Let $X$ denote a random variable. Then from a rigorous mathematical perspective (books such as Durrett, Feller, Kolmogorov, etc.),
$X$ is a function. $X: \Omega \to \mathbb{R}^n$.
Domain of the function is the sample space, $\Omega$
Range is a value in $\mathbb{R}^n$.
In supervised learning, let $X, Y$ denote the random variable corresponding to the data $x_n \in \mathbb{R}^n$ and target $y_n \in \mathbb{R}$ respectively.
Then $X$ maps from a sample space into a piece of data $x_n$. And $Y$ maps from a sample space into a piece of target, $y_n$.
With this, the notation, such as $p_{X|Y}(x_n|y_n) = \Pr[X = x_n| Y = y_n]$
is completely well defined.
Then we can start talking about things like logistic regression, i.e.,
$p_{X|Y}(x_n|y_n) = \Pr[X = x_n| Y = y_n] = \text{logit}(y_nw^Tx_n) \in (0,1)$
etc.
But what is the sample space $\Omega$? Any example would be much appreciated!