The existence of a function $f$ as specified in the question cannot be proved in ZFC. This follows from the following theorem and the well-known independence of $\mathrm{V = OD}$ (equivalently: $\mathrm{V = HOD}$) from $\mathrm{ZFC}$. Recall that $\mathrm{OD}$ is the class of ordinal-definable sets.

**Theorem.** (ZFC) *There is a (parameter-free) definable injective function $f$ from the class of subsets of ordinals to the class of ordinals (i.e., a definable function $f$ satisfying properties (1) and (2) of the question) if and only if* $\mathrm{V = OD}$.

**Proof.** The right-to-left direction readily follows from the well-known fact that there is a (parameter-free) global well-ordering of the class of all sets $\mathrm{V}$ of order-type $\mathrm{Ord}$ (class of ordinals) in the presence of $\mathrm{ZF + V = OD}$.

For the other direction, recall that it is a theorem of $\mathrm{ZFC}$ that every set can be canonically coded by a subset of ordinals (more precisely, for every set $x$ there is a subset $y$ of ordinals such that $x \in \mathrm{L}(y)$). This makes it clear that if there is a definable injection $f$ of the class of subsets of ordinal into the class $\mathrm{Ord}$ of ordinals, then there is an injection $F$ of the class of all sets $\mathrm{V}$ to $\mathrm{Ord}$. More specifically, given a set $x$, let $F(x)$ be $f(y_0)$, where $f(y_0)$ is the minimum element of the set of all ordinals of the form $f(y)$, where $y$ canonically codes $x$. Since $\mathrm{V=OD}$ is equivalent to the existence of a parameter-free definable injection of $\mathrm{V}$ into $\mathrm{Ord}$, this completes the proof.