Certainly you can test for a difference of proportion (it's equivalent to testing $P(\text{prefers A}) = \frac12$). The usual test would be the binomial test, or you might use a normal approximation to the binomial (in which case, with $p_0=\frac12$ I'd suggest using a continuity correction), or a chi-squared goodness of fit test (or indeed other tests are possible).
However, on those data you will have no hope of rejecting the null at any reasonable significance level; under the null, the standard error of the difference between the counts will be larger than the observed difference; with $n=40$ you'd need an observed difference more than three times as big for a two-tailed p-value to reach typical significance levels.