Intensity-modulated optical lattice potentials can change sign for an alkali-metal Rydberg atom, and the atoms are not always attracted to intensity minima in optical lattices with wavelengths near the CO${}_{2}$ laser band. Here we demonstrate that such IR lattices can be tuned so that the trapping potential experienced by the Rydberg atom can be made to vanish for atoms in ``targeted'' Rydberg states. Such state-selective trapping of Rydberg atoms can be useful in controlled cold Rydberg collisions, cooling Rydberg states, and species-selective trapping and transport of Rydberg atoms in optical lattices. We tabulate wavelengths at which the trapping potential vanishes for the $ns$, $np$, and $nd$ Rydberg states of Na and Rb atoms and discuss advantages of using such optical lattices for state-selective trapping of Rydberg atoms. We also develop exact analytical expressions for the lattice-induced polarizability for the ${m}_{z}=0$ Rydberg states and derive an accurate formula predicting tune-out wavelengths at which the optical trapping potential becomes invisible to Rydberg atoms in targeted $l=0$ states.