The three-dimensional band structure and superconducting gap of Ba0.6K0.4Fe2As2 are studied with angle-resolved photoemission spectroscopy. In contrast with previous results, we have identified three holelike Fermi surface sheets near the zone center with sizable out-of-plane or kz dispersion. The superconducting gap on certain Fermi surface sheets shows significant kz dependence. Moreover, the superconducting gap sizes are different at the same Fermi momentum for two bands with different spatial symmetries (one odd, one even). Our results further reveal the three-dimensional and orbital-dependent structure of the superconducting gap in iron pnictides, which facilitates the understanding of momentum-integrated measurements and provides a distinct test for theories.