The number of unshared, or lone, pairs will be the half number of valence electrons left after covalent bonds have been formed, modified to account for formal charge.
Thus, the oxygen in methoxide ion has 6 (its group number) plus 1 (to account for a formal charge of -1) less 1 that is involved in the covalent bond to carbon for a total of 6. Unshared pairs are 6/2 = 3.
This can be reduced to the formula
UP = 1/2[G - f - b]
where G is the group number from the periodic table, f is the formal charge (algebraic sign included), and b is the number of covalent bonds to the atom.
In the case of the methoxide oxygen this gives:
UP = 1/2[6-(-1)-1] = 3.