1: \begin{abstract}
2: {Given an arbitrary function in $\Hdiv$, we show that the error attained by the global-best approximation by $\Hdiv$-conforming piecewise polynomial Raviart--Thomas--N\'ed\'elec elements under additional constraints on the divergence and normal flux on the boundary, is, up to a generic constant, equivalent to the sum of independent local-best approximation errors over individual mesh elements, without constraints on the divergence or normal fluxes.
3: The generic constant only depends on the shape-regularity of the underlying simplicial mesh, the space dimension, and the polynomial degree of the approximations.
4: The analysis also gives rise to a stable, local, commuting projector in $\Hdiv$, delivering an approximation error that is equivalent to the local-best approximation.
5: We next present a variant of the equivalence result, where robustness of the constant with respect to the polynomial degree is attained for unbalanced approximations.
6: These two results together further enable us to derive rates of convergence of global-best approximations that are fully optimal in both the mesh size $h$ and the polynomial degree $p$, for vector fields that only feature elementwise the minimal necessary Sobolev regularity.
7: We finally show how to apply our findings to derive optimal a priori $hp$-error estimates for mixed and least-squares finite element methods applied to a model diffusion problem.}
8: \ifIMA{best approximation; piecewise polynomial; localization; $\Hdiv$ Sobolev space; Raviart--Thomas--N\'ed\'elec space; minimal regularity; optimal error bound; commuting projector; mixed finite element method; least-squares method; a priori error estimate.}\fi
9: \end{abstract}