I am getting into the same issue. I managed to find a get around, to use InfoPath 2003 object model instead of InfoPath 2007 object model.
Go to Form, Options and set the Form template code language to C# (InfoPath 2003 Compatible) and add the following code,
[InfoPathEventHandler(MatchPath = "btnHello", EventType = InfoPathEventType.OnClick)]
public void btnHello_OnClick(DocActionEvent e)
{
thisXDocument.UI.Alert("Hello");
}
I'm still trying to find the proper way to use the InfoPath 2007 object model to register the event handler of a custom toolbar button.
Simon