If you have married a U.S. citizen or permanent resident, and applied for U.S. lawful permanent residence (a green card) on that basis, an annulment is likely to either complicate or cancel your application process. Much like a divorce, the exact effect will depend on how far along in the application process you are.
If your U.S. spouse has started the process for you by filing a visa petition on Form I-130, and even if that petition has been approved, you yourself have no rights to reside in the U.S., much less to apply for a green card on the basis of that marriage. The purpose of family-based green cards is to promote family unity, and the immigration laws figure there's no family in such a case to unify.
Like the situation described above, submitting a green card or immigrant visa application on the basis of an annulled marriage will not be successful. The culmination of this process will be a visa or green card interview, at which time you'll be expected to prove that the marriage is ongoing and your U.S. spouse continues to be willing and able to sponsor you financially (or more literally, pay back the government if you end up needing public assistance). If the interview is held in the United States, your U.S. husband or wife will be expected to attend.
Unless you had already been married for two years or more when you applied for the green card, you will have received conditional residence status (which is essentially a green card, but one that expires in two years unless you prove that you deserve a permanent green card).
If you did, it's possible to go forward toward a permanent green card even after an annulment. However, you'll need to request a waiver of the usual requirement that you and your U.S. spouse jointly file the petition asking to convert from conditional to permanent residence (Form I-751).
To request such a waiver, you'll need to prove that:
You'll need to provide documents from the last two years showing that your marriage was the real thing. The same kinds of documents that you've shown the immigration authorities before will help -- evidence of having bought or rented a house together, of having combined your finances with joint bank accounts and credit cards, photos from vacations together, and so forth, will all be helpful. But make sure they're more recent than the documents you presented with your green card application.
Realize also that you're not trying to prove you had a good marriage! Even letters from marriage counselors and the like can help prove that it was the real thing -- struggling with marital issues is something that many real couples go through.
You'll also need a copy of your annulment certificate. If the annulment isn't yet final by the time you need to file Form I-751 (which is due within the 90 days before the expiration of your conditional resident status), that can be problematic. Talk to an attorney. And whatever you do, get the Form I-751 in on time, even if you don't have the certificate yet.
See Documents Needed for Filing an I-751 Form for more on what you're trying to show, and how to show it.
If the annulment isn't yet final, you might also look for alternative grounds upon which to request a waiver, such as if you were the victim of battery or extreme cruelty by your U.S. spouse, or would face extreme hardship if removed from the United States.
If you've already received U.S. permanent resident (a green card that doesn't expire in two years), an annulment should not affect you. You have a legal right to retain that status, assuming the original marriage was not a fraud to obtain a green card.
However, if and when you apply for U.S. citizenship, USCIS will have another opportunity to look into whether your marriage was a real thing. You can expect the annulment to raise questions, and should collect and save any documents showing your attempts to make a life together, which you'll likely be asked to present to USCIS following your citizenship interview.