A heker is something which makes something clear to people who see it. In this halacha, a heker makes it clear to the observer that the food they see cooking or being eaten is not a forbidden mixture of meat and dairy. If one wishes to cook meat in a dairy substitute, or vice versa, it is possible to avoid the marat ayin by putting a heker that shows that this is not a real mixture of meat and dairy. The heker has to be immediately clear to all who see the food that there is no prohibition being transgressed. A sign that this is not real meat or not real milk is acceptable according to most poskim, but the sign has to be very large and noticeable, not just a little note on the side of the food that may be overlooked. An acceptable heker would be to place the package of the food on the table which shows that it is non-dairy.
After the fact, if the food was already made and there is no heker available, it is permitted to eat the food, but not if it was cooked with the prior knowledge that no heker would be available. (ט”ז יו”ד פז ס”ק ד)
If the food is one that is routinely made with a non-dairy substitute, and anyone seeing the food would assume that this is not a forbidden dish, it is permitted to make the food and eat it without a heker. For example, cream of chicken soup served in wedding halls is made with margarine and non-dairy milk, and it is common knowledge that the soup served is not a forbidden mixture of chicken and milk, so one would not need a heker to serve and eat the soup. (שו”ת אגרות משה או”ח ח”א סי’ צו)