The oxidation number refers to the charge on the central atom of a compound when the ligands attached to it are removed and so are the atoms that associated with the ligand.
For the sulfate anion it is the oxidation state that can be determined not the oxidation number. Using the oxidation numbers of the the atoms that constitute the sulfate ion that has a formula of SO4, the oxidation state is determined by adding the oxidation number of sulfur and oxygen. Sulfur has an oxidation number of 6, or it loses 6 atoms when it forms a chemical compound. Oxygen atoms on the other hand accept 2 electrons each when they form a compound. The sulfate anion has a formula of SO4, this gives a net oxidation state of +6 + 4*(-2) = -2
This can be verified from the formula of any compound in which the sulfate anion is present. For example H2SO4, CaSO4 etc., in each of these compounds the sulfate anion combines with atoms with a net oxidation number of +2 and this creates an electrically neutral molecule.
Oxidation states depend on the number of valence electrons.
Oxidation state of sulfate is -2 which means that sulfate has extra has extra two electrons to share with the other element
Eg: Barium sulfate