This question might be naive for the practitioers of GR and Cosmology. But as an outsider in the field, I could not resist the temptation of asking this.
The theory of General Relativity dictates that whenever there is matter or energy density, it curves spacetime. But even though the matter and energy densities in the Universe are nonzero, the Universe is spatially flat. Why is that?
What determines the curvature parameter $k$ in the Friedman-Robertson-Walker metric? In particular, I want to know whether $k$ depends on (and therefore, is determined by) the various energy densities in the Universe or is it a parameter independent of various energy densities?
EDIT: From Friedman equations, $\frac{k}{a^2}$ appears as another component of energy density in addition to $\rho_{mat},\rho_{rad}$ and $\rho_{\Lambda}$. Does it therefore mean $\frac{k}{a^2}$ is an independent component of energy density? And like other energy components ($\rho_{mat},\rho_{rad}$ and $\rho_{\Lambda}$), is $k$ also an independent experimental input?
However, according to GR energy densities should fix the curvature, and it's not independent. Then what is that happens here?