To be honest there is only one way to avoid divorce 100% and that is not to get married. Relationships and marriage are not an exact science.
Some the best ways to reduce the odds of getting divorced is to make sure you are "ready" to join your life with another person. This means doing some introspective thinking to figure out exactly what it is you need, want, or desire from a future spouse. It also means getting your own house in order sort of speak. In other words complete your education, get some training, or do whatever to start down your chosen career path. Make sure you are not in significant debt at the start of a marriage. Hopefully one has also done some dating, traveling, and gained a lot of knowledge about themselves.
(Until you figure out who you are and what you want it will be impossible to select the "right mate" for yourself.)
Each of us chooses our own friends, lovers, and spouse. Ultimately you want to select someone who shares your same values, has mutual feelings for you, and has the same goals for the marriage. Couples who (naturally agree) most of the time tend to be happier and stay together.
Lastly keep things in perspective. A divorce is nothing more than one or both people coming to the realization that a mistake was made. Being a human means we make mistakes in all areas of our lives. Getting involved with or marrying the wrong person is no exception. Staying together for the sake of staying together is not the same as being "happily married".
There is no amount of "communication" or "work" that can overcome being with someone who does not want what you want." Be wise when selecting your spouse!