Rather than trying to make a pipe work, are you willing to use the with() function?
df <- data.frame(ID=1:6, col1=c(0,1,2,0,5,0), col2=c("A1", "A2", "B1", "B2","C1", "A3"))
with(df, which(col1 == 0 & grepl("A", col2, fixed=TRUE)))
#> [1] 1 6
<sup>Created on 2025-07-12 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup>