Use 2x4 Studs 90 Degrees from Normal
You certainly can. Just be aware that they won't be as rigid in the case that you hang heavy objects on them, such as cabinetry. You might consider putting one or two fasteners into the concrete through each stud, leaving an air space behind the stud. (You don't want untreated lumber in contact with masonry.)

Alternatively, built your wall  as you normally would and notch those studs around the pipe at the top. Use a 2x2 for a top plate behind the pipe. This will leave you with more robust framing and the ability to install full-size outlet boxes, etc.