Magnetic island formation in three-dimensional plasma equilibria