  We reveal the existence of a certain hidden symmetry in general ghost-free
scalar-tensor theories which can only be seen when generalizing the geometry of
the spacetime from Riemannian. For this purpose, we study scalar-tensor
theories in the metric-affine (Palatini) formalism of gravity, which we call
scalar-metric-affine theories for short, where the metric and the connection
are independent. We show that the projective symmetry, a local symmetry under a
shift of the connection, can provide a ghost-free structure of
scalar-metric-affine theories. The ghostly sector of the second-order
derivative of the scalar is absorbed into the projective gauge mode when the
unitary gauge can be imposed. Incidentally, the connection does not have the
kinetic term in these theories and then it is just an auxiliary field. We can
thus (at least in principle) integrate the connection out and obtain a form of
scalar-tensor theories in the Riemannian geometry. The projective symmetry then
hides in the ghost-free scalar-tensor theories. As an explicit example, we show
the relationship between the quadratic order scalar-metric-affine theory and
the quadratic U-degenerate theory. The explicit correspondence between the
metric-affine (Palatini) formalism and the metric one could be also useful for
analyzing phenomenology such as inflation.
