A Divergence-Free Immersed Boundary Method and Its Finite Element Applications