Hi,
The power in the resistor is the source voltage minus the LED voltage, then that squared, then that divided by the resistor value in Ohms.
So (12-3.5)^2/27=2.7 watts so use a 5 watt resistor.
The above comes from:
take 12 the power supply voltage, subtract the LED voltage (3.5 nominal) and that gives you 8.5, then multiply that by itself so we have 8.5 times 8.5 and that gives us 72.25, then divide that by the resistance (27) and we get finally 2.6759 which i rounded to 2.7, which is the actual wattage. But we need to go higher than that in wattage to keep the temperature at a reasonable level so we double that and come up with close to 5 watts. A 10 watt resistor would be even better.