It has to know the constructor in order to know the type of n. In your case they are both int, but in the general case they could be completely different types and therefore you could not just use the constructors interchangeably.
If you want to write this I would go:
data Foo = Bar Int | Foo Int
def unFoo (Bar n) = n
def unFoo (Foo n) = n
f v = if even (unFoo n) then True else False
You could also define the data type as
data Foo = Bar { unFoo :: Int } | Foo { unFoo :: Int }
As long as you make sure unFoo works for every possibility (otherwise it would be a partial function that could throw an exception).