  As a formulation of 'codimension-two arguments' in invariant theory, we
define a (rational) almost principal bundle. It is a principal bundle off
closed subsets of codimension two or more. We discuss the behavior of the
category of reflexive modules over locally Krull schemes, the category of the
coherent sheaves which satisfy Serre's condition $(S'_2)$ over Noetherian
$(S_2)$ schemes with dualizing complexes, the class group, the canonical
module, the Frobenius pushforwards, and global $F$-regularity, of a rational
almost principal bundle. We give examples of finite group schemes, multisection
rings, surjectively graded rings, and determinantal rings, and give unified
treatment and new proofs to known results in invariant theory, algebraic
geometry, and commutative algebra, and generalize some of them. In particular,
we generalize the result on the canonical module of the multisection ring of a
sequence of divisors by Kurano and the author. We also give a new proof of a
generalization of Thomsen's result on the Frobenius pushforwards of the
structure sheaf of a toric variety.
