Answer:
You cannot prevent it entirely.
Avoid common gas producing foods and foods you maybe allergic or intolerant of. Common gas producers: Apples, Apricots, Beans, Bran, Broccoli, Brussels sprouts, Cabbage, Carrots, Cauliflower, Dairy products, Eggplant, Nuts, Onions, Peaches, Pears, Popcorn, Prunes, Raisins, Soybeans, Tuna.