The concept of a principal G-bundle over a base space M is the mathematical foundation for the concept of a gauge field, where G is the gauged group and M is space or spacetime. A trivial principal bundle M\times G→ M exists for every combination of G and M. Nontrivial principle bundles exist for some combinations of G and M but not for others. When they do exist, they may be constructed using what this article calls patches – trivial principal G-bundles over parts of the base space M, glued together using transition functions, also called clutching functions. This article uses that approach to derive some results about the (non)existence of nontrivial principal G-bundles when G is a compact Lie group and when the base space is an n-dimensional sphere or an n-dimensional torus, for various values of n.